bigshwa05 Posted November 30, 2006 Share Posted November 30, 2006 After hours of endless searching of google for some help or information on this issue i thought i'd reach out to the community. I am trying to use a very simple PHP script to process the contents of a standard html form. The problem that's occurring is the FULL NAME field cuts off everything after the first word.ie. if i enter Billy Ray Cyrus in the FULL NAME textbox when the form is processed and transmitted all that is included is Billy. ???I am trying to use the FULLNAME textbox to populate the sender line of the email. Here is the form and the code i am using to process it any help would be greatly appreciated.//*****HTML FORM*****<form method="post" action="sendmail.php"><table width="100%" border="0"> <tr> <td width="21%"> Full Name: </td> <td width="79%"><input name="fullname" type="text" /></td> </tr> <tr> <td>Email:</td> <td><input name="email" type="text" /></td> </tr> <tr> <td>City:</td> <td><input name="city" type="text" /></td> </tr> <tr> <td>Apply to: </td> <td> <select name="applyto"> <option value="hr1@hrcompany.com">Mr. Bean</option> <option value="hr2@hrcompany.com">Mrs. Corn</option> <option value="hr3@hrcompany.com">Ms. Carrot</option> </select> </td> </tr> <tr> <td>Position:</td> <td><select name="position"> <option value="Promotional Rep">Promotional Rep</option> <option value="Demonstrator">Demonstrator</option> <option value="Field Manager">Field Manager</option> <option value="Cosmetic Demonstrator">Cosmetic Demonstrator</option> <option value="Hair Stylist">Hair Stylist</option> </select></td> </tr></table> <br> Please Copy and Paste Your Resume :<br><textarea name="resume" rows="15" cols="60"></textarea><br><input type="submit"></form>// **** PHP SCRIPT TO PROCESS FORM DATA ******<body><?php $to = $_REQUEST['applyto'] ; $subject = $_REQUEST['position'] . " + " . $_REQUEST['city'] ;$email = $_REQUEST['email'] ; $message = $_REQUEST['resume'] ;$headers = "From:$fullname"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; }else {print "We encountered an error sending your mail"; }?> </body></html> Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 30, 2006 Share Posted November 30, 2006 [CODE]<?php$to = $_REQUEST['applyto'] ;$subject = $_REQUEST['position'] . " + " . $_REQUEST['city'] ;$email = $_REQUEST['email'] ;$message = $_REQUEST['resume'] ;$headers = "From:$_POST[fullname]"; #<-- line modified$sent = mail($to, $subject, $message, $headers) ;if($sent){print "Your mail was sent successfully"; }else{print "We encountered an error sending your mail"; }?> [/CODE] Quote Link to comment Share on other sites More sharing options...
bigshwa05 Posted November 30, 2006 Author Share Posted November 30, 2006 wow quick reply! Unfortunetley that also is excluding any words following the first space i put in. :( Quote Link to comment Share on other sites More sharing options...
bljepp69 Posted November 30, 2006 Share Posted November 30, 2006 I'm pretty sure the full variable is getting passed to the processing page. You can test by putting the following line at the top of the code and you will see all your $_POST variables.[code]echo "POSTS: <pre>".print_r($_POST,TRUE)."</pre>";[/code]I think your problem is that the "From:" header is looking for a little different format. Try one of these:[code]$headers = "From: {$_POST['fullname']} <$email>";//or$headers = "From: $email";[/code] Quote Link to comment Share on other sites More sharing options...
bigshwa05 Posted November 30, 2006 Author Share Posted November 30, 2006 Fantastic! :DThanks guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.