Please Help With Mail Send Script

Please help me with this. I’m using this little PHP program to collect some information and get them emailed to me…everything is working but no messages in the body. The email comes to me but nothing in the body. I’m supposed to get the name, email, phone # and how soon but I receive a blank email. I have the script posted on celebritynosejobs.net if you would like to see it!

[php]<?php
$action=$_REQUEST[‘action’];
if ($action=="") /* display the contact form /
{
?>



Fill out the form below and we’ll contact you with more information as soon as possible.




Your full name:



Your email address:



Your Phone #:



How soon?



We hate spam too! Your information will only be shared with the doctor.


<?php
}
else /
send the submitted data */
{
$name=$_REQUEST[‘name’];
$email=$_REQUEST[‘email’];
$phone=$_REQUEST[‘phone’];
$howsoon=$_REQUEST[‘howsoon’];
if (($name=="")||($email=="")||($phone=="")||($howsoon==""))
{
echo “

All fields are required, please fill <a href=”">the form again.

";
}
else{
$from=“From: $name<$email>\r\nReturn-path: $email”;
$subject=“Free Plastic Surgery Consultation Request”;
mail("[email protected]", $subject, $message, $from);
echo “

Form is sent! Thank you for using CelebrityNoseJobs.net to find a Cosmetic/Plastic Surgeon practice in $details->city. We will provide your information to participating specialists in the area and they will get back to you with more information as soon as possiblle.

”;
}
}
?>[/php]

  1. Don’t use $_REQUEST use $_POST instead
  2. I think if you separate the php from the HTML as much as possible it would make the job easier.

For example:

[php]<?php
if (isset($_POST[‘action’]) && $_POST[‘action’] == “submit”) {
// Your email Script here
}
?>

[/php]

Now you might have a little PHP intermingled with the HTML, for example

<?php echo $message = isset($message) ? $message : "Contact Form"; ?>

Or you could simply have your HTML completely separated from your HTML by redirecting the user to a separate page.

Where are you assigning anything to $message?

Sponsor our Newsletter | Privacy Policy | Terms of Service