Al's HTML PHP Form processing
Posted: Mon Aug 31, 2009 2:35 pm
Below is my code & here is my problem. I cannot figure out how the variables in the html are transfered/transmitted/become available for use, in the PHP script. That's posted below as well. I don't think this is a code problem... It's got to be a setup problem. I have tryed to get it to work on my server and using my local host and I get the same results in both cases. All I get is this err
Now Starting...
Notice: Undefined index: email in D:\wamp\www\Asimple.php on line 6
Email var is:
############ html file ################
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html">
<title>Simple.htm</title>
<style type="text/css"> BODY {background: lightyellow}
</style>
</head>
<body>
<FORM action="http://localhost/Asimple.php" method="post">
<p>
<LABEL for="firstname">First name: </LABEL>
<INPUT type="text" firstname="firstname" size="20" maxlength="40" />
<LABEL for="lastname">Last name: </LABEL>
<INPUT type="text" lastname="lastname" size="20" maxlength="40" /><BR>
<LABEL for="email">email address: </LABEL>
<INPUT type="text" email="email" size="30" maxlength="60" /><BR><BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</p>
</FORM>
</body>
</html>
############ PHP file ##############
<?php # Script 1.0 - Asimple.php
ini_set('display_errors', 1);
echo "Now Starting... \n";
$email = $_POST['email'];
echo "Email var is: $email \n";
?>
Now Starting...
Notice: Undefined index: email in D:\wamp\www\Asimple.php on line 6
Email var is:
############ html file ################
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html">
<title>Simple.htm</title>
<style type="text/css"> BODY {background: lightyellow}
</style>
</head>
<body>
<FORM action="http://localhost/Asimple.php" method="post">
<p>
<LABEL for="firstname">First name: </LABEL>
<INPUT type="text" firstname="firstname" size="20" maxlength="40" />
<LABEL for="lastname">Last name: </LABEL>
<INPUT type="text" lastname="lastname" size="20" maxlength="40" /><BR>
<LABEL for="email">email address: </LABEL>
<INPUT type="text" email="email" size="30" maxlength="60" /><BR><BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</p>
</FORM>
</body>
</html>
############ PHP file ##############
<?php # Script 1.0 - Asimple.php
ini_set('display_errors', 1);
echo "Now Starting... \n";
$email = $_POST['email'];
echo "Email var is: $email \n";
?>