File add.php in CookBook
<?php require_once('Include/config.php'); ?> <html> <head> <title>Add New 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 = "INSERT INTO cookbook_recipes (title, ingredients, directions) VALUES ('$title','$ingredients', '$directions')"; $result = mysql_query($sql); //while (list($name, $value) = each($HTTP_POST_VARS)) {echo "$name = $value<br>\n";} echo "Recipe Added.\n [<a href=\"index.php\">Back to index</a>][<a href=\"add.php\">Add New Recipe</a>]"; } else{ // display form ?> <form method="post" action="<?php echo $PHP_SELF?>"> Title:<br> <input name="title" type="Text" size="75" maxlength="255"><br> Ingredients:<br> <textarea name="ingredients" cols="75" rows="6"></textarea><br> Directions:<br> <textarea name="directions" cols="75" rows="6"></textarea><br> <input type="Submit" name="submit" value="Add Recipe"> </form> <?php } // end if ?> </div> <div class="copyright" align="center">© 2004 <a href="http://www.fuzzymonk.com">Chrisopher Sexton</a></div> </body> </html>
