BrentonHale Posted December 19, 2009 Share Posted December 19, 2009 I'm getting the following notice/error message: Notice: Undefined variable: email in C:\wamp\www\handle_form.php on line 52 <!DOCTYPE html PUBLIC "-//W3C// DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml-transitional.dtd"> <html xmlns="http://www.w3.org/1999/ xhtml" xml:lang"en" lang"en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Form Feedback</title> </head> <body> <?php # Script 2.6 - handle_form.php $name = stripslashes($_POST['name']); $comments = stripslashes($_POST['comments']); echo "<p>Thank you, <b>$name</b>, for the following comments:<br/> <tt>$comments</tt></p> <p>We will reply to you at <i> {$_POST['email']} </i>.</p>\n"; if (!empty($_REQUEST['comments'])) { $comments = stripslashes($_REQUEST['comments']); } else { $comments = NULL; echo '<p><font color="red"> You forgot to enter yor comments!</font></p>'; } if (isset($_REQUEST['gender'])) { $gender = $_REQUEST['gender']; if ($gender == 'M') { $message = '<p><b>Good day, Sir!</b></p>'; } elseif ($gender == 'F') { $message = '<p><b>Good day, Madam!</b></p>'; } else { $message = NULL; echo '<p><font color="red">Gender should be either "M" or "F"!</font></p>'; } } else { $gender = NULL; echo '<p><font color="red">You forgot to select your gender!</font></p>'; } if ($name && $email && $gender && $comments) { echo "<p>Thank you, <b>$name</b>, for the following comments:<br/> <tt>$comments</tt></p> <p>We will reply to you at <i>{$_POST['email']}</i>.</p>\n"; echo $message; } else { echo '<p><font color="red"> Please go back and fill out the form again.</font></p>'; } ?> </body> </html> Could someone help me out please. Thanks! Link to comment https://forums.phpfreaks.com/topic/185659-php-array-form-handler/ Share on other sites More sharing options...
abazoskib Posted December 19, 2009 Share Posted December 19, 2009 It's telling you exactly what the error is. You have set the variable $email, but you use it in your if statement. Link to comment https://forums.phpfreaks.com/topic/185659-php-array-form-handler/#findComment-980351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.