PHP Email Array Help!

Discussion in 'PHP' started by Mitle, Oct 7, 2010.

  1. #1
    Hi im having trouble with attaching a posted array to my email script. Here is the code...
    //Form Snippet
    <td align="right" valign="top">Holes</td>
    <td align="left"><select name="holes[]" size="9" multiple>
    <option value="none" selected="selected">None</option>
    <option value="Top Middle">Top Middle</option>
    <option value="Left Middle">Left Middle</option>
    <option value="Bottom Middle">Bottom Middle</option>
    <option value="Right Middle">Right Middle</option>
    <option value="Top Left">Top Left</option>
    <option value="Top Right">Top Right</option>
    <option value="Bottom Left">Bottom Left</option>
    <option value="Bottom Right">Bottom Right</option>
    </select>
    //End Form Snippet
    //PHP
    <?php

    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $company = $_POST['company'];
    $abn = $_POST['abn'];
    $email = $_POST['email'];
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $size = $_POST['size'];
    $material = $_POST['material'];
    $rounded = $_POST['rounded'];
    $holes=$_POST['holes'];
    $background = $_POST['background'];
    $print = $_POST['print'];
    $quantity = $_POST['quantity'];


    if (eregi('http:', $notes)) {
    die ("Html not allowed in forms.");
    }
    if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
    {
    echo "<h2>Use Back - Enter valid e-mail</h2>\n";
    $badinput = "<h2>Feedback was NOT submitted</h2>\n";
    echo $badinput;
    die ("Go back! ! ");
    }

    if(empty($name) || empty($email) || empty($company )) {
    echo "<h2>Use Back - fill in all s</h2>\n";
    die ("Use back! ! ");
    }

    $todayis = date("l, F j, Y, g:i a") ;

    $attn = $attn ;
    $subject = $attn;

    $notes = stripcslashes($notes);

    $message = " $todayis [EST] \n
    From: $name ($email)\n
    Company: $company \n
    ABN: $abn \n
    Email: $email \n
    Name: $name \n
    Phone: $phone \n
    Size: $size \n
    Material: $material \n
    Rounded Corners: $rounded \n
    Hole Locations: $holes \n <<<<-Outputs text saying array or when $t posts blank
    Background Colour: $background \n
    Print Colour: $print \n
    Quantity: $quantity \n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";

    $from = "From: $email\r\n";


    mail('example@hotmail.com', $subject = "Online - Custom Form Request", $message, $from);

    ?>
    // End PHP
    //HTML
    <html>
    <h2>Your Order Details</h2>
    <p>Thank You:</strong> <?php echo $name ?> ( <?php echo $email ?> ) <br />
    below is a copy of the Quote for a Custom Sign sent. We will get back to you as soon as possible.</p>
    <p>Full Name:</strong> <?php echo $name ?> <br />
    <p>Company:</strong> <?php echo $company ?> <br />
    <p>ABN:</strong> <?php echo $abn?><br />
    <p>Email:</strong> <?php echo $email ?><br />
    <p>Phone Number:</strong> <?php echo $phone ?><br />
    <p>Size of sign:</strong> <?php echo $size ?><br />
    <p>Material:</strong> <?php echo $material ?><br />
    <p>Rounded Corners:</strong> <?php echo $rounded ?><br />
    <p>Hole Locations:</strong><br />
    <?php
    if ($holes){
    foreach ($holes as $t){echo 'You selected ',$t,'<br />';}
    }
    ?>
    <br />
    <p>Background Colour:</strong> <?php echo $background ?><br />
    <p>Print Colour:</strong> <?php echo $print ?><br />
    <p>Quantity:</strong> <?php echo $quantity ?><br />
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    Your Ip Address is: <strong><?php echo $ip ?></strong> which has been recorded for security reasons.</p>
    </html>
    //End HTML
    The Array posts fine when showing the results but adding it to the email send script i cant figure out. Any help would be greatly appreciated.
     
    Mitle, Oct 7, 2010 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    can you just post the specific code your having problems with
     
    bartolay13, Oct 12, 2010 IP
  3. Mitle

    Mitle Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey bartolay13 its ok i have changed my plan to complete the task i used checkboxes instead of a multiple selects list. What i was hoping to achieve here was having a customer selects multiple items from a drop down list and post it to a thankyou page. I belive my problem was in posting back the data to the send email script.

    Thankyou for offering your help.
     
    Mitle, Oct 16, 2010 IP