Jump to content

vivefree

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by vivefree

  1. 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!
×
×
  • 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.