Page 1 of 1

can only include 2 chunks of text in email message

Posted: Fri Nov 20, 2009 12:30 pm
by Kearn
Hi

I’ve made a form in Flash Builder (Flex 4) with 12 text input boxes, which are assigned to variables in Flash Builder, which are in turn assigned in the PHP script. I’m trying to use a PHP script to take the text typed into those boxes and put it in a email. The problem I’m running into is only the contents of the first two boxes are included in the email. The arbitrary title headings I put into the email message body are included but the content of the boxes are not, just the id of the text box, ie textBox2.text. So it returns Stove: kitStove.text rather than Stove: an old electric the owner won’t fix.

Is this an inherent limitation of a PHP generated email, or is this result due to my mistake? This is the script:

Code: Select all

 
<!--
<?php
    $senderName = $_POST['senderName'];
    $senderEmail =  $_POST['senderEmail'];
    $sendToName = $_POST['sendToName'];
    $sendToEmail = $_POST['sendToEmail'];
    $kitCleanProd = $_POST['kitCleanProd'];
    $kitWaterFiltra = $_POST['kitWaterFiltra'];
    $kitStove = $_POST['kitStove'];
    $kitFridge = $_POST['kitFridge'];
    $kitMicroWave = $_POST['kitMicroWave'];
    $kitToasterOven = $_POST['kitToasterOven'];
    $kitGrill = $_POST['kitGrill'];
    $kitBlender = $_POST['kitBlender'];
    $kitOtherAppl = $_POST['kitOtherAppl'];
    $kitCookWare = $_POST['kitCookWare'];
    $kitBulbs = $_POST['kitBulbs'];
    
 
    $recipient = "$sendToEmail";
    $subject = "Kitchen Questionnaire";
    $headers = "From: $senderEmail ";
    $message = "From: $senderName\n\n
            Email Address: $senderEmail\n\n
            Cleaning Products: $kitCleanProd\n\n
            Water Filtration: $kitWaterFiltra\n\n
            Stove: kitStove\n\n
            Fridge: kitFridge\n\n
            Microwave: kitMicroWave\n\n
            Toaster Oven: kitToasterOven\n\n
            Grill: kitGrill\n\n
            Blender: kitBlender\n\n
            Other Appliances: kitOtherAppl\n\n
            Cookware: kitCookWare\n\n
            Light Bulbs: kitBulbs";
    $message = StripSlashes($message);
    
    
    mail($recipient, $subject, $message, $headers)
?>
-->
 
I’m editing the PHP with TextWrangler. The line breaks come up as set to Windows(CRLF) and I leave them set as such. I’m on a Mac and my script is on my Earthlink server (don’t have PHP set up on my computer).

Thanks for your attention.

Kearney

Re: can only include 2 chunks of text in email message

Posted: Fri Nov 20, 2009 2:32 pm
by califdon
Look at your code. You included the required dollar sign at the beginning of only the first 2 items. :-)

Lacking the beginning dollar signs, PHP doesn't recognize those as variables.

Re: can only include 2 chunks of text in email message

Posted: Sat Nov 21, 2009 9:25 am
by Kearn
You're right: the code change you suggested corrected the problem.

Thank you much for seeing that.

Kearney