Hi, I have a strange problem and don't know how to fix it, but it is very important to get it fixed, because the form won't send without it. For some reason the form won't send unless the form field "requesteremail" has data in it and I don't know why. So I thought if I just put an error command if the field was empty everything would work anyway, because people would be prompted to fill in the field. But when I add the "if empty" statement, for some reason it is also ignored, unless something is in the "requesteremail" field. I don't get it, it makes no sense to me, but I really need it fixed. Hope someone will help. Thank you very much.
PHP Code:while ($row = mysql_fetch_array($result)){
if ($_POST['websitename']==""){?>
<form method="post" action="<?php $_SERVER['PHP_SELF'] ;?>">
<input type="hidden" value="<?php echo $row[websitename];?>" name="websitename">
<input type="text" name="requesteremail" size=20>
<input type="text" name="page" size=20>
<input type="submit" name="submit" value="Submit" /></form>
<?php
}
else{
$mailto = 'emailaddress@something.com' ;
$subject = "Subject of email" ;
$websitename = $_POST['websitename'] ;
$requesteremail = $_POST['requesteremail'] ;
$page = $_POST['page'] ;
$uself = 0;
$sep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$messageproper = "$websitename\n" . "$requesteremail\n" . "$page\n";
mail($mailto, $subject, $messageproper, "From: \"$requesteremail\" <$requesteremail>" . $sep . "Reply-To: \"$requesteremail\" <$requesteremail>" . $sep);
if (empty($requesteremail) || empty($requesterwebsite)) {echo "field empty please try again";}
else {echo "email sent!";}
}}}//these 3 brackets needed from other mysql variables earlier.
?>




Bookmarks