|  | Posted by Jerry Stuckle on 11/17/07 18:08 
Sam Bench wrote:> I am very new to php and know virtually nothing about it.  I want to do a
 > very simple task:
 >
 > I have a form that generates 5 outputs: $name, $email, $number,and $mission,
 > $type.  I want to have a .php file email these 5 outputs to a certain email
 > address.  I am close to figuring out how to do this.  I have setup a .php
 > file as follows:
 >
 > <?php
 > @extract($_POST);
 > $name = stripslashes($name);
 > $email = stripslashes($email);
 > $number = stripslashes($number);
 > $mission= stripslashes($mission);
 > $type=stripslashes($type);
 > $strsub="Poinsettia Order";
 > $mail_body=$name+$email+$mission+$type+$number;
 > mail('joesmith@comsat.com', $strsub,$mail_body, "From: $name <$email>");
 > echo("Thank you for your poinsettia order.  Your order was sent to the admin
 > in charge.");
 > ?>
 >
 > I have uploaded the .html form and the above .php file to my server.  When I
 > run the form, I almost get what I want.  When I hit send on the form I get
 > an email sent to me.  It has $strsub as the subject.  It has $name
 > <$email>in the From field.  However, in the body of the email I don't get
 > all the form information that I want.  In fact, the above code just sends me
 > $number.  The rest of the form info is missing.  How can I fix the code so
 > that all 5 fields that I want appear in the body of the email that gets sent
 > to me?
 >
 > Thanks in advance.
 >
 >
 >
 
 In addition to what the others said - "From: $name <$email>" is very
 insecure.  It can open your server to spammers.  At the very least strop
 out any newline characters in it.
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
 [Back to original message] |