thefuzmixman
04-15-2004, 01:18 PM
basically i had a php script i had downloaded and tried to add it to my own existing html form. the script i downloaded worked fine.
<?php
if ($submit) { // if the form was sent do the following
if($Fname && $phone && $email && $message ) { // if all field are filled-in send email
mail("thefuzmixman@yahoo.com","$phone","$message","From: $Fname <$email>") or die("email error");
echo "Message Sent"; // if all went well, display message was sent
} else {
echo "All fields must be filled in!<BR>"; // if not all were filled in, display error message
}
} // end php submission code
?>
when i added this information, i changed the variables to suit my own needs, but the script no longer worked. i found that i needed to add 2 hidden fields
<input type="hidden" name="mailTo" value="myaddress@domain.com">
<input type="hidden" name="Subject" value="Comment from Domain.com">
and viola... problem solved. also i didnt specify an action for the form. in the downloaded version there wasnt one either, however i used this.....
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
another thing that was messed up was the mail() variable order.
When i used "mailto/message/xheaders" it was sending the message body as the subject and nothing as a message. lol..
when i used "mailto/subject/message/xheaders" everything was fine. so i supposed one should not tamper with order here. :eek:
<?php
if ($submit) { // if the form was sent do the following
if($Fname && $phone && $email && $message ) { // if all field are filled-in send email
mail("thefuzmixman@yahoo.com","$phone","$message","From: $Fname <$email>") or die("email error");
echo "Message Sent"; // if all went well, display message was sent
} else {
echo "All fields must be filled in!<BR>"; // if not all were filled in, display error message
}
} // end php submission code
?>
when i added this information, i changed the variables to suit my own needs, but the script no longer worked. i found that i needed to add 2 hidden fields
<input type="hidden" name="mailTo" value="myaddress@domain.com">
<input type="hidden" name="Subject" value="Comment from Domain.com">
and viola... problem solved. also i didnt specify an action for the form. in the downloaded version there wasnt one either, however i used this.....
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
another thing that was messed up was the mail() variable order.
When i used "mailto/message/xheaders" it was sending the message body as the subject and nothing as a message. lol..
when i used "mailto/subject/message/xheaders" everything was fine. so i supposed one should not tamper with order here. :eek: