jaydoh73 Posted September 29, 2011 Share Posted September 29, 2011 I've put together a very simple form & processing script for my site.. Everything works great except the body of the email i receive when the form is submitted contains everything but the info that has been entered into the fields. I'm sure it's something simple that I'm overlooked, but I'm officially stumped. What am I doing wrong here? <?php $mymail = 'ordietryingodt@yahoo.com'; $cc = 'New Recruit To Add!'; $BoDy = ' '; $FrOm = 'FROM:' .$_POST['t1']; $FrOm .= 'Reply-To:' .$_POST['t1']; $FrOm .= 'X-MAILER: PHP'.phpversion(); $BoDy .= 'Quake Live Name: '; $BoDy .= $_POST['t1']; $BoDy .= "\n"; $BoDy .= 'Age: '; $BoDy .= $_POST['t2']; $BoDy .= "\n"; $BoDy .= 'Residing Country: '; $BoDy .= $_POST['t3']; $BoDy .= "\n"; $BoDy .= 'Favorite Game Type: '; $BoDy .= $_POST['t4']; $BoDy .= "\n"; $send = mail("$mymail", "$cc", "$BoDy", "$FrOm"); if($send) { echo '<html><head>'; echo '<meta http-equiv="refresh" content="0;URL=/submitted.htm">'; echo '</head><body>Email send....'; echo '</body></html>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/ Share on other sites More sharing options...
Buddski Posted September 29, 2011 Share Posted September 29, 2011 Can you show us the form? Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/#findComment-1274061 Share on other sites More sharing options...
mikesta707 Posted September 29, 2011 Share Posted September 29, 2011 try doing a print_r on $_POST to see what its contents are. afterwards, if the contents arent right check your form to make sure its being submitted properly, and the field names match. Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/#findComment-1274088 Share on other sites More sharing options...
jaydoh73 Posted September 29, 2011 Author Share Posted September 29, 2011 Can you show us the form? Here is the html code for the form... <form method="post" action="process.php"> <table style="WIDTH: 407px; HEIGHT: 170px" width="407"></tr> <tbody> <tr> <td valign="top"><label for="t1">Quake Live Name *</label> </td> <td valign="top"><input maxlength="15" size="30" name="QL_name"> <tr> <td valign="top" ?><label for="t2">Age *</label> </td> <td valign="top"><input style="WIDTH: 52px; HEIGHT: 22px" maxlength="2" size=6 name=Age> <tr> <td valign="top"><label for="t3">Residing Country *</label> <td valign="top"><input maxlength="15" size="30" name="Country"> </td></tr> <tr> <td valign="top"><label for="t4">Favorite Game Type</label></td> <td valign="top"><input maxlength="10" size="30" name="Game_Type"> </td></tr> <tr> <td style="TEXT-ALIGN: center" colspan="2"><input value="Submit" type="submit"> </td></tr></tbody></table></form> Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/#findComment-1274177 Share on other sites More sharing options...
Howlin1 Posted September 29, 2011 Share Posted September 29, 2011 The information that you call is what's in the name attribute and not the label. So instead of $_POST['t1'] you should have $_POST['QL_name'] etc etc Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/#findComment-1274181 Share on other sites More sharing options...
mikesta707 Posted September 29, 2011 Share Posted September 29, 2011 1 thing i noticed, is you are missing the double quotes around your name attributes, namely <input style="WIDTH: 52px; HEIGHT: 22px" maxlength="2" size=6 name=Age> Another is that you are using the names t1, t2, etc. as array keys for the $_POST super global, but the keys you need to be using correspond to the name attribute of the input. for example, if you wanted to access the Favorite Game Type input box, you would use $_POST['Game_Type'] not $_POST['t1'] or t2 or whatever EDIT: howlin posted the second thing I said, but the first is also something you should consider Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/#findComment-1274182 Share on other sites More sharing options...
jaydoh73 Posted September 30, 2011 Author Share Posted September 30, 2011 Awesome! I fixed those two errors & now it works great. Thank you both. Quote Link to comment https://forums.phpfreaks.com/topic/248113-data-entered-into-fields-isnt-showing-on-the-email/#findComment-1274239 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.