the_real_JLM Posted March 26, 2008 Share Posted March 26, 2008 I garantee I'm doing something wrong here, but I cant seem to figure it out... It is returning everything but the Drivers License value. sorry to keep pestering you guys HTML form code: <form method="post" action="sendmail.php"> <input name="email" type="text" value="Email Address" /> <input name="firstname" type="text" value="First Name" /> <input name="lastname" type="text" value="Last Name" /> <br /> <input name="telephone" type="text" value="Telephone" /> <input name="drivers" type="text" value="Drivers License? (Y/N)" /> <input name="position" type="text" value="Position" /> <br /> <input name="address" type="text" value="Address" size="73" /> <br /> <textarea name="message" rows="15" cols="70">Employment History: References: Availability: Comments:</textarea> <br /> <input type="submit" /> </form> sendmail code: <?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $firstname = $_REQUEST['firstname'] ; $lastname = $_REQUEST['lastname'] ; $telephone = $_REQUEST['telephone'] ; $drivers = $_REQUEST['drivers'] ; $position = $_REQUEST['position'] ; $address = $_REQUEST['address'] ; mail( "[email protected]", "Job Application", $firstname . ' ' . $lastname . "\n" . $telephone . "\n" . 'Drivers License: ' . $drivers . "\n" . 'Position Applying For: ' . $position . "\n" . 'Address: ' . $address . "\n" . $message , "From: $email" ); header( "Location: index.php" ); ?> Email body Recieved: Jody McIvor 0000000000 Drivers License: <---should be a "Y" here, as entered on the php form, but returns nothing Position Applying For: Office Monkey Address: HereThere Street Employment History:blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah References:blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah Availability:blah blah blah blah blah Comments:blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/ Share on other sites More sharing options...
conker87 Posted March 26, 2008 Share Posted March 26, 2008 Change $_REQUEST to $_POST to be slightly more securerer. This is a toughy, are you sure you've just forgot to input any data into that field? Really, really sure? Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/#findComment-501469 Share on other sites More sharing options...
the_real_JLM Posted March 26, 2008 Author Share Posted March 26, 2008 Change $_REQUEST to $_POST to be slightly more securerer. This is a toughy, are you sure you've just forgot to input any data into that field? Really, really sure? Yep I just double checked. I'll try out your $_POST suggestion, thanks Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/#findComment-501476 Share on other sites More sharing options...
conker87 Posted March 26, 2008 Share Posted March 26, 2008 Try changing the name of the drivers field to something like dLicense and try again. $drivers might be a global variable. Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/#findComment-501491 Share on other sites More sharing options...
kenrbnsn Posted March 26, 2008 Share Posted March 26, 2008 I took your original code, modified it somewhat and tested the modified code. It worked fine. Here's the modified code: <?php $post_array = array('name' => '', 'drivers' => 'Drivers License: ', 'position' => 'Position Applying For: ', 'address' => 'Address: ', 'message' => ''); if (isset($_POST['submit'])) { $email = $_POST['email'] ; $tmp = array(); $tmp['name'] = ''; foreach ($_POST as $key => $val) switch($key) { case 'firstname': case 'lastname': $tmp['name'] .= $val . ' '; break; case 'email': $email = stripslashes($val); break; case 'submit': break; default: $tmp[$key] = trim(stripslashes($val)); } $tmp2 = array(); foreach ($post_array as $key => $lbl) $tmp2[] = ($lbl != '')?$lbl . stripslashes($tmp[$key]):$tmp[$key]; mail( "[email protected]", "Job Application",implode("\n",$tmp2)."\n" , "From: $email" ); } ?> <html> <head> <title>Job Application</title> </head> <body> <form method="post" action=""> <input name="email" type="text" value="Email Address" /> <input name="firstname" type="text" value="First Name" /> <input name="lastname" type="text" value="Last Name" /> <br /> <input name="telephone" type="text" value="Telephone" /> <input name="drivers" type="text" value="Drivers License? (Y/N)" /> <input name="position" type="text" value="Position" /> <br /> <input name="address" type="text" value="Address" size="73" /> <br /> <textarea name="message" rows="15" cols="70">Employment History: References: Availability: Comments:</textarea> <br /> <input type="submit" name="submit" value="Send Info" /> </form> </body> </html> Ken Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/#findComment-501493 Share on other sites More sharing options...
the_real_JLM Posted March 26, 2008 Author Share Posted March 26, 2008 Try changing the name of the drivers field to something like dLicense and try again. $drivers might be a global variable. yea i tried that, it was originally $driverslicense. @kenrbnsn, I"ll try your code out, thanks Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/#findComment-501507 Share on other sites More sharing options...
the_real_JLM Posted March 26, 2008 Author Share Posted March 26, 2008 I took your original code, modified it somewhat and tested the modified code. It worked fine. Here's the modified code: <?php $post_array = array('name' => '', 'drivers' => 'Drivers License: ', 'position' => 'Position Applying For: ', 'address' => 'Address: ', 'message' => ''); if (isset($_POST['submit'])) { $email = $_POST['email'] ; $tmp = array(); $tmp['name'] = ''; foreach ($_POST as $key => $val) switch($key) { case 'firstname': case 'lastname': $tmp['name'] .= $val . ' '; break; case 'email': $email = stripslashes($val); break; case 'submit': break; default: $tmp[$key] = trim(stripslashes($val)); } $tmp2 = array(); foreach ($post_array as $key => $lbl) $tmp2[] = ($lbl != '')?$lbl . stripslashes($tmp[$key]):$tmp[$key]; mail( "[email protected]", "Job Application",implode("\n",$tmp2)."\n" , "From: $email" ); } ?> <html> <head> <title>Job Application</title> </head> <body> <form method="post" action=""> <input name="email" type="text" value="Email Address" /> <input name="firstname" type="text" value="First Name" /> <input name="lastname" type="text" value="Last Name" /> <br /> <input name="telephone" type="text" value="Telephone" /> <input name="drivers" type="text" value="Drivers License? (Y/N)" /> <input name="position" type="text" value="Position" /> <br /> <input name="address" type="text" value="Address" size="73" /> <br /> <textarea name="message" rows="15" cols="70">Employment History: References: Availability: Comments:</textarea> <br /> <input type="submit" name="submit" value="Send Info" /> </form> </body> </html> Ken works nicely, and fixed the issue, thanks ken Link to comment https://forums.phpfreaks.com/topic/98007-sendmail-not-returning-all-strings/#findComment-501523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.