can only include 2 chunks of text in email message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Kearn
Forum Newbie
Posts: 2
Joined: Fri Nov 20, 2009 12:26 pm

can only include 2 chunks of text in email message

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

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

Post 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.
Kearn
Forum Newbie
Posts: 2
Joined: Fri Nov 20, 2009 12:26 pm

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

Post by Kearn »

You're right: the code change you suggested corrected the problem.

Thank you much for seeing that.

Kearney
Post Reply