PDA

View Full Version : PHP Code Problem


synopsis15
09-23-2002, 05:20 PM
Hey everybody.

If anyone can help me out with this I'd appreciate it....

Here's the code:
----------------------------------------------------

<?php

if ($submit) {
if (($title=="") || ($url=="") || ($info=="") || ($keywords=="") || ($email=="") || ($fname=="") || ($phone=="") || ($comments=="") || ($lname=="")) {
$msg = "<p><font face=verdana size=2><b>Error</b>: You have left a required field empty.</font></p>";
}
}
?>

<?php if (isset($msg)) {
echo "$msg";
} else {
$toemail = "joe@itopsite.com";
$emailtitle = "Process Immediately.";
$webmasteremail = "sales@itopsite.com";
$emailbody = "$title\n";
$emailbody .= "$url\n";
$emailbody .= "$info\n";
$emailbody .= "$keywords\n";
$emailbody .= "$email\n";
$emailbody .= "$fname\n";
$emailbody .= "$lname\n";
$emailbody .= "$phone\n";
$emailbody .= "$comments\n";

mail("$toemail", "From $webmasteremail : $emailtitle", $emailbody, "From: $email\r\n" ."Reply-To: $email\r\n");
echo("<p><font face=verdana size=2><B>E-mail successfully sent. We will be processing your order shortly. Thank you!<B></font></p>");

}
?>



----------------------------------------------------
end code


The whole thing is based off of www.itopsite.com. You go to Order, place an order, get sent to PayPal, then click Continue to visit the order2.php page for another form. The problem is, that form is sending a blank answer back to me everytime someone loads the page. It just automatically sends a completely blank form back to me. But when someone doesn't fill in a required field, it does not send in the form if they click the submit button. The submit button works fine and it gets mailed to me with the right information, but I don't know how to stop it from just sending a blank form back to me right off the bat.


Any help would be greatly appreciated.


Thanks,


Joe

c q
09-28-2002, 04:19 PM
what is the difference between your $msg and $comments variables ??
something's telling me thats whr the problem is :thumbsup: