Jump to content

Data entered into fields isn't showing on the email,


Recommended Posts

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?  :confused:

<?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>';

}

?>

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>

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.