SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying to send email of form contents

    Hello,

    I have made a registration form for my church to help automate the registration process for a summer program. I have the form complete... I tried to post a link here, but this site won't allow it ....





    The form takes the data being entered, and upon submission it writes to a php page that shows the data entered, and allows for correction prior to prior submission. If the data looks good, the submit button goes to a sendmail page.

    The problem is the sendmail php script does send the email, but the data being passed is empty.

    I help I need is some guidance on how to get the variables which sucusssfully pass from the htm page to the first php page ..... to also pass to the sendmail php page.
    See the code below and thanks in advace for any help!

    ------------------------------------------------------

    <?php


    // Set Vars
    $mother_fn = $_REQUEST ['mother_fn'];
    $address = $_REQUEST ['address'];
    $city = $_REQUEST ['city'];
    $state = $_REQUEST ['state'];
    $zip = $_REQUEST ['zip'];
    $email = $_REQUEST ['email'];

    // set the variables
    // replace with your email address
    $sendto = "";
    $subject = "VBS 2009 Registration";
    $message = "$mother_fn, $address, $city, $state, $zip, $email";
    $extra = 'Cc: ;

    // send the email
    mail($sendto, $subject, $message, $extra);

    ?>

  2. #2
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On the preview page you could create a form with hidden inputs and populate those values then make a submit button or you could use sessions to hold the values and reset the session every time the first page is displayed.
    Have a good day.

  3. #3
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by candleman View Post
    Hello,


    <?php


    // Set Vars
    $mother_fn = $_REQUEST ['mother_fn'];
    $address = $_REQUEST ['address'];
    $city = $_REQUEST ['city'];
    $state = $_REQUEST ['state'];
    $zip = $_REQUEST ['zip'];
    $email = $_REQUEST ['email'];


    ?>
    are you asking request from one page to another? because your are using here $_REQUEST. if you are not accesing data form one page to another you should use $_POST instead of $_REQUEST.

    // set the variables
    // replace with your email address
    $sendto = "";
    $subject = "VBS 2009 Registration";
    $message = "$mother_fn, $address, $city, $state, $zip, $email";
    $extra = 'Cc: ;

    // send the email
    mail($sendto, $subject, $message, $extra);
    $sendto is empty. how can than mail function would know to whether to send the mail. and headers are also missing. bellow is sample mail format which works for me.
    PHP Code:
                                        $mailbody       "Dear Sir,";
                           
    $mailbody     .= "<p>";
                           
    $mailbody      .= $address;
                           
    $mailbody      .= $city;
                           
    $mailbody      .= $state;
                            
    $mailbody     .= "</p>";

                           
    $mailbody     .= "<p>Regards.</p>";


                           
    $subject       "VBS 2009 Registration";
                           
    $fromemail     $fromemail;
                           
    $to            $to;
                           
    $msg           $mailbody;

                           
    $headers       "MIME-Version: 1.0" "\r\n";
                           
    $headers      .= "Content-type: text/html; charset=iso-8859-1" "\r\n";
                           
    $headers      .= "From:".$fromemail"\r\n";
                           
    $headers;

                           if(
    mail($to$subject$msg$headers)){
                                           
    ob_clean();

                        
    //  echo "Mail has been sent Successfully.";
                         
    echo      = "success";


                          }
                         else
                         {
                                      
    ob_clean();

                                 echo       
    "failed";



         } 

  4. #4
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your replys ... Deepson2 .... if you have less than 10 posts on this board, you can not post any URL addresses or emails .... so the $sendto had to be stripped of it's contents in order for me to post my question and code.

    candleman

  5. #5
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    candleman, have you tried this code?


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •