Jump to content

For someone who know's their stuff...


vivefree

Recommended Posts

I've created a simple form online which is then translated into a message stored in a php variable then sent using the mail() function.

My first page has the form.  The form's action is set to: vol_app.php.  The php code in vol_app.php looks like as follows:

<?php

$cname = $_POST["name"];
$caddress = $_POST["address"];
$ccity = $_POST["city"];
$cphone = $_POST["phone"];
$cinterests = $_POST["interests"];
$cmessage = $_POST["message"];
$coded_name = htmlspecialchars($cname);
$coded_address = htmlspecialchars($caddress);
$coded_city  = htmlspecialchars($ccity);
$coded_phone = htmlspecialchars($cphone);
$coded_interests = htmlspecialchars($cinterests);
$coded_message = htmlspecialchars($cmessage);

if($_POST["morning"] && $_POST["afternoon"]) $shift_for_message = "Both";
if($_POST["morning"] && !$_POST["afternoon"]) $shift_for_message = "Morning";
if(!$_POST["morning"] && $_POST["afternoon"]) $shift_for_message = "Afternoon";


$body = "Name: ".$coded_name."\n\nPhone: ".$coded_phone."\n\nAddress: \n".$coded_address."\n".$coded_city."\n\nHobbies or Interests:\n".$coded_interests."\n\nMorning or Evening Shift?: ".$shift_for_message."\n\nWhy you choose to volunteer at Desert Manna:\n".$coded_message;
$to = "myemail@mydomain.net";
$subject = "Volunteer Application";

mail($to, $subject, $body);
?>


Here's my problem.  Everytime I use this script I get two emails.  The first email contains all of the information in the $body variable, except the embedded variables are just blank.  The email looks like this:

Name:
Phone:
etc...

The second email is works as planned.
If anyone can help me with this I would greatly appreciate it!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.