I don't know why my code doesn't allow a user to retain what they typed in. I have 7 fields, but I only care for 4 fields:
first name
last name
email
comments
...NOTE: if i filled in firstname, lastname, and email, but leave comments blank. only lastname and email retained inputs while firstname is blank. My conclusion: firstname and comments do not retain their inputs once a user hit submit....In my submit, there are error checking to make sure that fields are not left empty:
<?PHP } if (!isset($fname) or !isset($lname) or !isset($company) or !isset($workphone) or !isset($emailaddress) or !isset($subject) or !isset($comments)) {
show_form();
}
else
if (empty($fname) || empty($lname) || empty($emailaddress) || empty($comments)) {
echo "<h2>Please fill in the required fields.</h2>";if
(empty($fname)) {
echo "First name is empty.<br />";
}
if (empty($lname)) {
echo "Last name is empty.<br />";
}
if
(empty($emailaddress)) {
echo "Email is empty.<br />";
}
if
(empty($comments)) {
echo "Did you forget to write your message?<br /><br>";
}
show_form($fname,$lname,$company,$workphone,$emailaddress,$subject,$comments);
}
else
{
sending to my email....
?>