Click to See Complete Forum and Search --> : Contact Form


Jick
07-26-2003, 09:35 AM
I have this PHP contact form and everything works fine except that when I recieve the e-mail with the info from the form it also sends the submit button. Here is my proccersor php file:
<?PHP
$to = "mjdimick@yahoo.com"; #set address to send form to
$subject = "The Dandy Group - Form Results"; #set the subject line
$headers = "From: contact@dandy.infinitypages.com"; #set the from address
$forward = 1; # redirect? 1 : yes || 0 : no
$location = "thankyou.php"; #set page to redirect to, if 1 is above

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "Below is the result of your contact form. It was submitted on $date at $time.\n\n";

foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo ("Thank you for submitting our form. We will get back to you as soon as possible.");
}

?>
Here is what the e-mail looks like when I recieve it:

----------------------------------------------------------
Below is the result of your contact form. It was submitted on
Saturday, July 26th, 2003 at 10:27 AM.

Name : Mike
Email : mike@test.com
Subject : Test
Message : this is a test message.
Submit : Send Message <---- This here!
----------------------------------------------------------

The line in bold is what I'm talking about. It's sending the submit button too but I don't want it too. Is there a way to make it so it dosn't send it? Thank you. :D

AdamGundry
07-26-2003, 10:10 AM
You should be able to change this line

$msg .= ucfirst ($key) ." : ". $value . "\n";

to this:

if ($key!="submit") $msg .= ucfirst ($key) ." : ". $value . "\n";

Adam