File delete.php in CookBook
<?php require_once('Include/config.php'); ?> <?php if( !$userdata['session_logged_in'] ) {?> You must <a href="http://www.fuzzymonk.com/forum/login.php?redirect=../chris/cookbook/">Login</a> in order to view this page. <? exit(); }?> <html> <head> <title>Edit Recipe</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="cookbook.css" rel="stylesheet" type="text/css"> </head> <body> <div id="main"> <?php if ($submit) { // process form $sql = "DELETE FROM cookbook_recipes WHERE id = '$id'"; //echo $sql; $result = mysql_query($sql); //print ($_POST['id']); echo "Recipe Deleted.\n [<a href=\"index.php\">Back to index</a>][<a href=\"add.php\">Add New Recipe</a>]"; } else { if(isset($_GET['id'])) {$id = $_GET['id'];} else {print("Error: Invalid ID. Looser.");exit;} $sql = "SELECT * FROM cookbook_recipes WHERE id=" . $id; $result = mysql_query($sql); // display form ?> <div class="RecipeTitle" align="right">Are you sure you want to delete this tasty recipe?</div> <form method="post" action="<?php echo $PHP_SELF?>"> <span class="TextTitle">Title:</span><br><br> <div class="Ingredients"><?=mysql_result($result,0,"title")?></div> <span class="TextTitle">Ingredients:</span><br> <div class="Ingredients"><?=mysql_result($result,0,"ingredients")?></div><br> <span class="TextTitle">Directions:</span><br> <div class="Directions"><?=mysql_result($result,0,"directions") ?></div><br> <input name="id" type="hidden" value="<?php echo $id; ?>"> <input type="Submit" name="submit" value="Delete It"> </form> <?php } // end if ?> </div> <div class="copyright" align="center">© 2004 <a href="http://www.fuzzymonk.com">Chrisopher Sexton</a></div> </body> </html>
