HTML Form not "Posting" user input values to PHP POST Arrary. I am trying to email a form -
HTML Form not "Posting" user input values to PHP POST Arrary. I am trying to email a form -
seemingly simple issue: have html form:
<form action="submit.php" method="post" enctype="text/plain"> <h3>owner information</h3> first name*: <br /> <input type="text" name="firstname" /><br /> lastly name*: <br /> <input type="text" name="lastname" /><br /><br /> owner on title?*: <br /> <input type="radio" name="titleowner" value="yes" />yes <input type="radio" name="titleowner" value="no" />no<br /><br /> </form>
and here submit.php:
<?php $admin_email = "aloha@hi.com"; $email = "hey@gmail.com"; $subject = "subject"; $message = htmlspecialchars($_post['firstname'] . " " . $_post['lastname']); $message .= "title owner? " . htmlspecialchars($_post["titleowner"]); $message .= "mailing address: " . htmlspecialchars($_post['mailingaddress']) . "city: " . htmlspecialchars($_post['city']) . "state:" . htmlspecialchars($_post['state']) . "zip code" . (int)$_post['zipcode'] . "phone number:" . strip_tags($_post['phonenum']); //send email mail($admin_email, $subject, $message); echo $message; //email response echo "thank contacting us!"; ?>
the 'echo message' produces when user submits:
title owner? mailing address: city: state:zip code0phone number:thank contacting us!
as can see, variable reason did not populate. help much appreciated. give thanks you.
this:
enctype="text/plain"
is culprit. text/plain encoding isn't reliably machine decodable , php won't parse it.
remove enctype
attribute entirely.
php html forms
Comments
Post a Comment