ziptrx Posted July 6, 2008 Share Posted July 6, 2008 I have searched for this answer and have yet to find it. I am creating a job application and all fields need to be sent in an email. I am not worried about field validation or anything else. This is just a simple fill and email form. I have everything created, but when receiving the email no fields are sent. The server is running PHP 4.3.11. Here is the beginning line for the form: <form action="process_form.php" method="post" enctype="text/plain" name="applicationForm" > Last line for submitting: <input type="submit" name="submitButton" value="Submit" disabled="true" > Sample of defining a variable on the process_form.php: (which if I understand correctly, it should retrieve the information from the field called name via POST and assign it to the variable $name. Am I correct? $name = $_POST['name']; And this is suppose to get the info from the $name variable and input it in the $message variable. Now this is where the problem starts. In the email FULL NAME: appears but not $name info. $message = "FULL NAME: $name"; I have also tried, different ways, only to fail: $messge = "FULL NAME:". $name ."/r/n"; Mail code which works. if ( mail($to,$subject,$message,$headers) ) { echo "The email has been sent!"; } else { echo "The email has failed!"; } It appears that I am screwing up the format for $message to work properly. Can someone point me in the right direction? Thanks. Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/ Share on other sites More sharing options...
AndyB Posted July 6, 2008 Share Posted July 6, 2008 Don't confuse $message and $messge. $name = $_POST['name']; // assuming the input is named name $message = "FULL NAME: ". $name. "/r/n"; // that's fine // and if there are more input vars, concatenate those into $message... // $message.= "ADDRESS: ". $address. "/r/n"; Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/#findComment-583002 Share on other sites More sharing options...
PseudoEvolution Posted July 6, 2008 Share Posted July 6, 2008 It would help if you posted all of the code, but everything looks fine here... Try $message = 'FULL NAME: ' . $name; It should work how you have it now, but who knows... Also, do an echo on $name to see if it's being submitted properly. If not, then recheck your input for name. Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/#findComment-583005 Share on other sites More sharing options...
kenrbnsn Posted July 6, 2008 Share Posted July 6, 2008 Remove the enctype="text/plain" from the form tag. Ken Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/#findComment-583038 Share on other sites More sharing options...
ziptrx Posted July 6, 2008 Author Share Posted July 6, 2008 Remove the enctype="text/plain" from the form tag. Ken Your suggestion worked, but now I get /r/n added into the email which I assume is caused by this: $message = "FULL NAME: ". $name. "/r/n"; I could only assume that these are some simple errors that I am overlooking, but sickness does that to a person. I would like to say thanks to all that have helped. I can see that this is a great helping community that I am looking forward to learning from and being a part of. Thank a lot for the help. Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/#findComment-583050 Share on other sites More sharing options...
DarkWater Posted July 6, 2008 Share Posted July 6, 2008 Should be: $message = "FULL NAME: ". $name. "\r\n"; You had / instead of \. Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/#findComment-583053 Share on other sites More sharing options...
ziptrx Posted July 6, 2008 Author Share Posted July 6, 2008 Should be: $message = "FULL NAME: ". $name. "\r\n"; You had / instead of \. Yeah I figured it out but couldn't edit my previous post. Now it's time to work on validation and all the other fun stuff. I'm sure I'll be posting on those problems. Thanks again you guys! Link to comment https://forums.phpfreaks.com/topic/113462-variables-not-being-set/#findComment-583055 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.