I'm writing my first php program and I'm having a problem. I'm receiving a "undefined index" message after using the "post' action in my form page, which calls the php page.
contactus.html:
<form action="reply.php" method="POST" name="ContactUs" target="_blank" enctype="text/plain">
<p> What is your name?<br>
<input name="name" type="text" size="35" maxlength="100">
</p>
<p> What is your email address?<br>
<input name="email" type="text" size="35" maxlength="100">
</p>
<p>What is your street address?<br>
<input name="StreetAddress" type="text" size="35" maxlength="150">
</p>
<p>What city do you live in?<br>
<input name="city" type="text" size="35" maxlength="100">
</p>
<p>What is your zip code?<br>
<input name="zipcode" type="text">
</p>
<p><strong>Tell us your thoughts. </strong></p>
<p>* Please use the area below to communicate your suggestions, ideas, comments or questions.</p>
<p>
<textarea name="textarea" cols="75" rows="10"></textarea>
</p>
<p>
<input name="SubmitButton" type="submit" value="Submit">
<input name="clear" type="reset" value="Clear">
</p>
</form>
the php page is:
Reply.php
<?php
/
build email msg, and build output screen
/
$to = "milthall@attglobal.net";
$subject = "contact Us - comments";
$name = $POST['name'];
$email = $POST['email'];
$address = $POST['StreetAddress'];
$city = $POST['city'];
$zipcode = $POST['zipcode'];
$text = $POST['textarea'];
$message = "name = " . $name . "email = " . $email . "address = " . $address . "city = " . $city . "zipcode = " . $zipcode . "comments = " . $text;
$headers = "From: CAAM website comments\r\n";
mail($to,$subject,$message,$headers);
echo "Hello\n\n\n";
echo "your name is = " . $name . "\n\n";
echo "your email address is = " . $email . "\n\n";
echo "your address is = " . $address . "\n\n";
echo "your city is = " . $city . "\n\n";
echo "your zip code is = " . $zipcode . "\n\n";
echo "your comments are = " . $text . "\n\n";
?>
and the error messages are:
Notice: Undefined index: name in C:\Inetpub\wwwroot\caam\reply.php on line 22
Notice: Undefined index: email in C:\Inetpub\wwwroot\caam\reply.php on line 23
Notice: Undefined index: StreetAddress in C:\Inetpub\wwwroot\caam\reply.php on line 24
Notice: Undefined index: city in C:\Inetpub\wwwroot\caam\reply.php on line 25
Notice: Undefined index: zipcode in C:\Inetpub\wwwroot\caam\reply.php on line 26
Notice: Undefined index: textarea in C:\Inetpub\wwwroot\caam\reply.php on line 27
Hello your name is =
your email address is = your address is = your city is = your zip code is = your comments are =
Does anyone have an idea of what is happening? thanks.