#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    2

    Php email two form. second form not sending


    i have a success.php page that once a order has been placed is sent to that page. i have set up two email scripts. one is sent if the buyer buys a product and the other is sent if the buyer books a course. (the reason i have made two is because they are using different variables)
    what seems to be happening is only the first script is working.

    PHP Code:
    <?php
    //emailer
    $to $row_rsOrder["BillingEmail"];//'test@email.com' ;//. ',' . '$row_rsOrder["Email"] . ';
    //$to = $row_rsOrder["Email"];
    $subject "Your Order Details";
    $message "
    <html>
     
    <head>
     
    <title>Dear "
    .$row_rsOrder['FirstName']." . ".$row_rsOrder['LastName']." please see your Order Details Below</title>
     
    </head>
     
            <body>
     
    <img src=\"http://www.website.com/images/email-logo.jpg\" alt=\"\" />
    <h2>Your Order "
    .$row_rsOrder['OrderID']."</h2>
    <table width='800' border='0' cellspacing='0' cellpadding='0'>
    <tr><td><p>Thank you for shopping below are you details of the order you have recently placed. If you have any questions please contact us</p>
    <br />
    </a></p>
    <tr><td></td></tr></table>
     
    <table width='980' border='1' cellspacing='0' cellpadding='10'>
     
          <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Customer Name</td>
     
            <td class='text'>"
    .$row_rsOrder['FirstName']." . ".$row_rsOrder['LastName']." </td>
     
            <td bgcolor='#E9E9E9' class='header1'>Order ID</td>
     
            <td bgcolor='#E9E9E9' class='text'>"
    .$row_rsOrder['OrderID']."</td>
     
            <td bgcolor='#E9E9E9' class='header1'>Order Status</td>
     
            <td class='text'>"
    .$row_rsOrder['TransactResult']."</td>
     
          </tr>
     
                             <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Email</td>
     
            <td class='text'>"
    .$row_rsOrder['Email'] . $row_rsOrder['BillingEmail']."</td>
     
            <td bgcolor='#E9E9E9' class='header1'> </td>
     
            <td class='text'> </td>
     
            <td bgcolor='#E9E9E9' ><span class='header1'>Order Date</span></td>
     
            <td class='text'>"
    .date('D, d/m/Y',strtotime($row_rsOrder['OrderDate']))."</td>
     
          </tr>
     
                            <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Shipping Address</td>
     
            <td class='text'><p>"
    .$row_rsOrder['Address']."</p>
     
              <p>"
    .$row_rsOrder['Town']."</p>
     
              <p>"
    .$row_rsOrder['PostCode']."</p>
     
              <p>"
    .$row_rsOrder['Country']."</p>
     
              <p> </p></td>
     
            <td> </td>
     
            <td> </td>
     
            <td colspan='2' align='right' valign='bottom'><span class='header'> ORDER TOTAL:"
    .$row_rsOrder['Total']."<br />
     
              </span><span class='text'>Shipping:"
    .$row_rsOrder['Shipping']."</span><span class='header'><br />
     
            </span></td>
                                      </tr>
     
          <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Product ID</td>
     
            <td bgcolor='#E9E9E9' class='header1'>Product Description</td>
     
            <td bgcolor='#E9E9E9' colspan='2' class='header1'>Size</td>
     
            <td bgcolor='#E9E9E9' ><span class='header1'>Quantity</span></td>
     
            <td bgcolor='#E9E9E9' align='right'><span class='header1'>Price</span></td>
     
          </tr>"
    ;

                            
    ?>
          <?php do { ?>
    <?php $message 
    .="  <tr valign='top'>
              <td class='text'>"
    .$row_rsEvent['event_title']."</td>
              <td class='text'>"
    .$row_rsEvent['event_desc']."</td>
              <td class='text'>&nbsp;</td>
              <td class='text'>&nbsp;</td>
              <td class='text'>"
    .$row_rsEvent['Quantity']."</td>
              <td class='text'>"
    .$row_rsEvent['event_price']."</td>
            </tr>"
    ;
            
    ?>
            <?php } while ($row_rsEvent mysql_fetch_assoc($rsEvent)); ?>
    <?php 
    do { ?>
     
    <?php $message .="  <tr valign='top'>
     
            <td class='text'>"
    .$row_rsOrder['ProductID']."</td>
     
            <td class='text'>"
    .$row_rsOrder['Product']."</td>
     
            <td colspan='2' class='text'>"
    .$row_rsOrder['UnitSize']."</td>
     
            <td><span class='text'>"
    .$row_rsOrder['Quantity']."</span></td>
     
            <td align='right' class='text'>"
    .''.$row_rsOrder['UnitPrice']."</td>
     
          </tr>"
    ;
                            
    ?>
     
    <?php } while ($row_rsOrder mysql_fetch_assoc($rsOrder)); ?>
     
     
     
    <?php $message .="
     
    </body>
     
    </html>"
    ;

            
    // Always set content-type when sending HTML email
            
    $headers "MIME-Version: 1.0" "\r\n";
            
    $headers .= "Content-type:text/html;charset=UTF-8" "\r\n";
            
    $headers .= 'From: webshop  <shop@webshop.com>' "\r\n";

            
    $send mail($to$subject$message$headers);
        
    ?></table></html>
    <?php
    //emailer2
    $toevent $row_rsEvent['BillingEmail'];//'email@webshop.com' ;//. ',' . '$row_rsOrder["Email"] . ';
    //$to = $row_rsOrder["Email"];
    $subjectevent "Your Order Details";
    $messageevent "
    <html>
     
    <head>
     
    <title>Dear "
    .$row_rsEvent['BillingCustomer']." please see your Order Details Below</title>
     
    </head>
     
            <body>
     
    <img src=\"http://www.webshop.com/images/email-logo.jpg\" alt=\"\" />
    <h2>Your "
    .$row_rsEvent['OrderID']."</h2>
    <table width='800' border='0' cellspacing='0' cellpadding='0'>
    <tr><td><p>Thank you for shopping below are you details of the order you have recently placed. If you have any questions please contact us</p>
    <br />
    </a></p>
    <tr><td></td></tr></table>
     
    <table width='980' border='1' cellspacing='0' cellpadding='10'>
     
          <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Customer Name</td>
     
            <td class='text'>"
    .$row_rsEvent['BillingCustomer']." </td>
     
            <td bgcolor='#E9E9E9' class='header1'>Order ID</td>
     
            <td bgcolor='#E9E9E9' class='text'>"
    .$row_rsEvent['OrderID']."</td>
     
            <td bgcolor='#E9E9E9' class='header1'>Order Status</td>
     
            <td class='text'>"
    .$row_rsEvent['TransactResult']."</td>
     
          </tr>
     
                             <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Email</td>
     
            <td class='text'>"
    $row_rsOrder['BillingEmail']."</td>
     
            <td bgcolor='#E9E9E9' class='header1'> </td>
     
            <td class='text'> </td>
     
            <td bgcolor='#E9E9E9' ><span class='header1'>Order Date</span></td>
     
            <td class='text'>"
    .date('D, d/m/Y',strtotime($row_rsEvent['OrderDate']))."</td>
     
          </tr>
     
                            <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Shipping Address</td>
     
            <td class='text'><p>"
    .$row_rsEvent['BillingAddress']."</p>
     
              <p>"
    .$row_rsEvent['BillingTown']."</p>
     
              <p>"
    .$row_rsEvent['BillingPostCode']."</p>
     
              <p>"
    .$row_rsEvent['BillingCounty']."</p>
     
              <p> </p></td>
     
            <td> </td>
     
            <td> </td>
     
            <td colspan='2' align='right' valign='bottom'><span class='header'> ORDER TOTAL:"
    .$row_rsEvent['Total']."<br />
     
              </span><span class='text'>Shipping:"
    .$row_rsEvent['Shipping']."</span><span class='header'><br />
     
            </span></td>
                                      </tr>
     
          <tr valign='top'>
     
            <td bgcolor='#E9E9E9' class='header1'>Product ID</td>
     
            <td bgcolor='#E9E9E9' class='header1'>Product Description</td>
     
            <td bgcolor='#E9E9E9' colspan='2' class='header1'>Size</td>
     
            <td bgcolor='#E9E9E9' ><span class='header1'>Quantity</span></td>
     
            <td bgcolor='#E9E9E9' align='right'><span class='header1'>Price</span></td>
     
          </tr>"
    ;

                            
    ?>
          <?php do { ?>
    <?php $messageevent 
    .="  <tr valign='top'>
              <td class='text'>"
    .$row_rsEvent['event_title']."</td>
              <td class='text'>"
    .$row_rsEvent['event_desc']."</td>
              <td class='text'>&nbsp;</td>
              <td class='text'>&nbsp;</td>
              <td class='text'>"
    .$row_rsEvent['Quantity']."</td>
              <td class='text'>"
    .$row_rsEvent['event_price']."</td>
            </tr>"
    ;
            
    ?>
            <?php } while ($row_rsEvent mysql_fetch_assoc($rsEvent)); ?>
    <?php 
    do { ?>
     
    <?php $messageevent .="  <tr valign='top'>
     
            <td class='text'>"
    .$row_rsEvent['event_id']."</td>
     
            <td class='text'>"
    .$row_rsEvent['event_title']."</td>
     
            <td colspan='2' class='text'>"
    .$row_rsOrder['UnitSize']."</td>
     
            <td><span class='text'>"
    .$row_rsEvent['Stock']."</span></td>
     
            <td align='right' class='text'>"
    .''.$row_rsEvent['event_price']."</td>
     
          </tr>"
    ;
                            
    ?>
     
    <?php } while ($row_rsEvent mysql_fetch_assoc($rsEvent)); ?>
     
     
     
    <?php $messageevent .="
     
    </body>
     
    </html>"
    ;

            
    // Always set content-type when sending HTML email
            
    $headers "MIME-Version: 1.0" "\r\n";
            
    $headers .= "Content-type:text/html;charset=UTF-8" "\r\n";
            
    $headers .= 'From: webshop  <shop@webshop.com>' "\r\n";

            
    $send mail($toevent$subjectevent$messageevent$headers);
        
    ?></table></html>
    i need to know what i am doing wrong, also can each one be sent to multiple recipients ?

    thanks in advance
    Last edited by jonnyfreak; July 15th, 2013 at 05:53 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    189
    Rep Power
    0
    Is this REALLY the code you are executing? I ask because it doesn't make sense to me. You are utilizing a bunch of values from an array that seems to be your query results array but you haven't run the query yet.

    Quite the display of spaghetti code here. Perhaps you could improve your style and try and separate the display pieces from the 'work' pieces and be able to make better sense of what you are trying to do here and solve the problem.

IMN logo majestic logo threadwatch logo seochat tools logo