Hello i need help with this function, what i am trying to do, is in this form, when people submit this form to go to the next page, i need to take them to the 2nd page, and the information that the person put in the form, to be emailed to me.
This is what i have : how come when i submit it does not send’s the email to me?? what am i missing? should the function be in the section? or where?
At the bottom i have the PHP function for email send.
Thankss
<table style="font-size: 12px;" align="center" border="0" cellpadding="2" cellspacing="2" width="320">
<tbody>
<tr>
<td style="position: relative;" id="frontpage_form_name_label" align="right" nowrap="nowrap">
<strong><span class="red_star">*</span> Nombre</strong>
</td>
<td align="left">
<input name="firstname" style="width: 125px;" type="text" formmethod="post">
</td>
</tr>
<tr>
<td style="position: relative;" id="frontpage_form_name_label" align="right" nowrap="nowrap">
<strong><span class="red_star">*</span> Apellido</strong>
</td>
<td align="left">
<input name="lastname" style="width: 125px;" type="text">
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">
<strong><span class="red_star">*</span>Sexo</strong>
</td>
<td align="left">
<input type="radio" name="gender" id="male" value="m"> Hombre
<input type="radio" name="gender" id="female" value="f"> Mujer
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">
<strong><span class="red_star">*</span>Tipo y Numero de Doc</strong>
</td>
<td align="left">
<select name="dtype">
<option value="dni" selected>dni</option>
<option value="cuil">cuil</option>
<option value="cuit">cuit</option>
<option value="le">le</option>
<option value="lc">lc</option>
<option value="cpf">cpf</option>
<option value="cnpj">cnpj</option>
<option value="rut">rut</option>
<option value="rfc">rfc</option>
<option value="curp">curp</option>
<option value="ife">ife</option>
<option value="lic">lic</option>
</select>
<input name="doc" style="width: 115px;" type="text">
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">
<strong><span class="red_star">*</span>Direccion</strong>
</td>
<td align="left">
<input name="street" style="width: 145px;" type="text">
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">
<strong><span class="red_star">*</span>Ciudad</strong>
</td>
<td align="left">
<input name="city" id="city" style="width: 125px;" type="text">
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">
<span id="state_select"><strong><span class="red_star">*</span>Estado/Provincia</strong></span>
</td>
<td align="left">
<input style="width: 125px;" name="state" type="text">
</td>
</tr>
<tr class="zipcode">
<td align="right" nowrap="nowrap">
<strong><span class="red_star">*</span>Codigo Postal</strong>
</td>
<td align="left">
<input name="zipcode" style="width: 125px;" type="text">
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">
<strong><span class="red_star">*</span>Pais</strong>
</td>
<td align="left">
<select name="country">
<option value="ar" selected>
Argentina
</option>
</select>
</td>
</tr>
<tr style="padding-bottom: 0px;">
<td style="padding-bottom: 0px; height: 10px;" align="right" nowrap="nowrap" valign="middle">
<strong><span class="red_star">*</span>Telefono</strong>
</td>
<td style="padding-bottom: 0px;" align="left">
<input name="phone" style="width: 125px;" type="text" id="POST" />
</td>
</tr>
<tr style="padding-bottom: 0px;">
<td style="padding-bottom: 0px; height: 10px;" align="right" nowrap="nowrap" valign="middle">
<strong><span class="red_star">*</span>E-mail</strong>
</td>
<td style="padding-bottom: 0px;" align="left">
<input name="email" style="width: 125px;" type="text">
</td>
</tr>
</tbody>
</table>
<?php
//check atleast one form field is in the POST to make sure form is submitted
if (isset($_POST[‘firstname’]))
{
//get all the form details to a one string
$emailBody = “”;
$emailBody .= "First Name : " . $_POST[‘firstname’] . “
”;
$emailBody .= "Last Name : " . $_POST[‘lastname’] . “
”;
$emailBody .= "Gender : " . $_POST[‘gender’] . “
”;
$emailBody .= "Name : " . $_POST[‘dtype’] . “
”;
$emailBody .= "Name : " . $_POST[‘street’] . “
”;
$emailBody .= "Name : " . $_POST[‘city’] . “
”;
$emailBody .= "Name : " . $_POST[‘state’] . “
”;
$emailBody .= "Name : " . $_POST[‘zipcode’] . “
”;
$emailBody .= "Name : " . $_POST[‘country’] . “
”;
$emailBody .= "Name : " . $_POST[‘phone’] . “
”;
$emailBody .= "Name : " . $_POST[‘email’] . “
”;
//email headers : just to show that this is a html content
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//sending the collected details as an email
mail('[email protected]', 'Subject', $emailBody, $headers);
//show a success message
echo "<div class='green'>Email sent</div>";
}
else
{
echo “Please fill the order form”;
}
?>
</form>