webdev077
06-09-2007, 07:25 PM
Hello everyone:
I tried to use extract function to display value submitted from a form.
The output I got is '0000', which is not correct. I couldn't figure out what my problem is. Please help me find the cause. Thanks!
HTML form:
<head>
<title>extract data from form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="process.php" method="post">
Name: <input type="text" name="" size="20" maxlength="20"><br/><br />
Email: <input type="text" name="" size="20" maxlength="20"><br/><br />
Subject: <input type="text" name="" size="20" maxlength="20"><br/><br />
Text: <textarea name="text" cols="50" rows="10"></textarea><br/><br />
<input type="submit" name="submit" value="send" />
<input type="reset" name="reset" value="reset" />
</form>
</body>
</html>
PHP code that will process form data:
<?php
extract($_POST); //extract data from $_POST array
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$text = stripslashes($text);
//mail the form information
$mail_to = "santa98bn@yahoo.com";
$from = "From: $name $email";
print ($name + "<br />");
echo ($email + "<br />");
echo ($subject + "<br />");
echo ($text + "<br />");
?>
webdev077
6-9-07
I tried to use extract function to display value submitted from a form.
The output I got is '0000', which is not correct. I couldn't figure out what my problem is. Please help me find the cause. Thanks!
HTML form:
<head>
<title>extract data from form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="process.php" method="post">
Name: <input type="text" name="" size="20" maxlength="20"><br/><br />
Email: <input type="text" name="" size="20" maxlength="20"><br/><br />
Subject: <input type="text" name="" size="20" maxlength="20"><br/><br />
Text: <textarea name="text" cols="50" rows="10"></textarea><br/><br />
<input type="submit" name="submit" value="send" />
<input type="reset" name="reset" value="reset" />
</form>
</body>
</html>
PHP code that will process form data:
<?php
extract($_POST); //extract data from $_POST array
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$text = stripslashes($text);
//mail the form information
$mail_to = "santa98bn@yahoo.com";
$from = "From: $name $email";
print ($name + "<br />");
echo ($email + "<br />");
echo ($subject + "<br />");
echo ($text + "<br />");
?>
webdev077
6-9-07