Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP5 : errors in form processor script ?

    $m does not print in confirm page using <?php echo $m; ?>, well ?
    also email does not delivered to $email (email of webuser) when he clicks checkbox for receive what has submitted ?

    Code:
    <?php 
    
    /* recipients */
    $email = $_POST['email']; 
    $to = "info@RiverViewVilla.com"; 
    
    $subject = "Booking Request for RiverViewVilla.com"; 
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $comments = $_POST['comments'];
    $emailme = $_POST['emailme'];   // checkbox
    // --------------------------------------
    $day = $_POST['day'];
    $month = $_POST['month'];
    $year = $_POST['year'];
    $today = $_POST['today'];
    $tomonth = $_POST['tomonth'];
    $toyear = $_POST['toyear'];
    
    		$tsp = mktime(0, 0, 0, $month, $day, $year);
    		$tsd = mktime(0, 0, 0, $tomonth, $today, $toyear);
    		$xdays = ($tsd - $tsp)/(24*60*60);
    		$datep = date("l F dS, Y", $tsp);
    		$dated = date("l F dS, Y", $tsd);     // check this  H:i 
    // --------------------------------------
    include_once ("book-confirm.php"); 
    
    ob_start();
    include('book-confirm.php');
    $message = ob_get_clean();
    
    ob_start();
    include('email-confirm.php');  //include('book-confirm-to-customer.php');
    $message_customer = ob_get_clean();
    
    $headers = "From:info@RiverViewVilla.com";                     
    // $headers .= "\nBcc:fontanatours@yahoo.com"
    $headers .= "\nReply-To:info@RiverViewVilla.com"; 
    $headers .= "\nContent-Type: text/html; charset=UTF-8";
    $headers .= "\nMIME-Version: 1.0";  
    
    mail($to,$subject,$message,$headers); 
    
    if ($emailme == "checked") {   
     mail($email,$subject,$message_customer,$headers); 
     $m = "An email message has been sent!" ;
    } else {
     $m = "No" ;
    }
    ?>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    $m needs to be stored in a session if you want it carried over. As to the user not getting the mail, its because you have this coded incorrectly.
    PHP Code:
    if ($emailme == "checked") {   
     
    mail($email,$subject,$message_customer,$headers); 
     
    $m "An email message has been sent!" ;
    } else {
     
    $m "No" ;

    It should be
    PHP Code:
    if (isset($emailme)) {   
     
    mail($email,$subject,$message_customer,$headers); 
     
    $m "An email message has been sent!" ;
    } else {
     
    $m "No" ;

    Here is a tutorial on php sessions. http://www.tizag.com/phpT/phpsessions.php
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but other vars from form do not need session , well ?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    If you are staying on the same page then no you don't need the session but you said it doesn't print in the confirm page which to me means its another page meaning you need a session.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why the other vars:
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $comments = $_POST['comments'];
    get print [with echo] to confirm page, and this var[$m] non print ?

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Because those are post variables. They get carried to whatever page they post to. $m is not a post variable. Listen to what I'm saying, you NEED a session.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I make it work but
    if ($emailme == "checked") {
    is always true ... what to do to correct ? emailme is the name of a checkbox of
    value=checkbox
    and also there's the statement:
    $emailme = $_POST['emailme']; // checkbox

  • #8
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    if ($emailme == "checkbox") {   
      mail($email,$subject,$message_customer,$headers); 
      $_SESSION['m'] = "An email message has been sent!" ;
    } else {
      $_SESSION['m'] = "No" ;
    }
    and

    Code:
    <?php session_start();  
    echo $_SESSION['m'];
    unset($_SESSION['m']);  ?>
    will work the second if i include the php file in an email message ? Seems no work ?
    try at(put your email): http://www.riverviewvilla.com/book.htm

    Also a javascript question : I use onfocus="this.blur()" at below, to confirm page and to page come to email but does not work, I may delete the textarea data at confirm pages ...

    <textarea name="comments" cols="40" rows="3" class="formfields" onfocus="this.blur()" id="comments"><?php echo $comments; ?></textarea>


  •  

    Posting Permissions

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