Jump to content

Recommended Posts

So, I'm trying to do a form for a website I have been hired to make. It looks like it sends it okay, but then I NEVER get the email. What the heck!? Can any of you much much much smarter people than me take a look at what I have done to see maybe if it's just a stupid mistake I'm making? Thanks.

Here's the form:
 

<form name="contactform" method="post" action="send_form_email1.php" id="contactform"">
 
<table width="600px">
 
<tr>
 
 <td valign="top">
 
  <label for="full_name">Full Name *</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="full_name" maxlength="50" size="30">
 
 </td>
 
</tr>
 
<tr>
 
 <td valign="top">
 
  <label for="telephone">Telephone Number *</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="telephone" maxlength="30" size="30">
 
 </td>
 
</tr>
 <tr>
 
<tr>
 
 <td valign="top">
 
  <label for="email">Email Address *</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="email" maxlength="80" size="30">
 
 </td>
 
</tr>
 
<tr>
 
 <td valign="top">
 
  <label for="day"> Day You Would like Your Massage </label>
 
 </td>
 
 <td valign="top">
 
  <select name="day"><option value=""></option>
<option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option></select>
 
 </td>
 
</tr>
<tr>
 
 <td valign="top">
 
  <label for="month"> Month You Would like Your Massage </label>
 
 </td>
 
 <td valign="top">
 
<select name="month"><option value=""></option>
<option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option></select>
 
 </td>
 
</tr>
<tr>
 
 <td valign="top">
 
  <label for="time"> Time you'd like your massage*</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="time" maxlength="10" size="15">
 
 </td>
 
</tr>
<tr>
 
 <td valign="top">
 
  <label for="how_many"""> Number of people</label>
 
 </td>
 
 <td valign="top">
 
 <input type="radio" name="how_many" value="1">1 | 
<input type="radio" name="how_many" value="2">2
 
 </td>
 
</tr>
<tr>
 
 <td valign="top">
 
  <label for="type"> Type of Massage </label>
 
 </td>
 
 <td valign="top">
 
<select name="type"><option value="Couples massage">Couples massage</option> <option value="Deep tissue, Swedish, sports or prenatal massage">Deep tissue, Swedish, sports or prenatal massage</option> <option value="Cupping massage">Cupping massage</option> <option value="Cranial sacral massage">Cranial sacral massage</option> <option value="Hot stone massage">Hot stone massage</option> <option value="Triggerpoint">Triggerpoint</option> <option value="Other">Other</option></select>
 </td>
 
</tr>
 <tr>
 <td valign="top"">
 
  <label for="credit_card_number"> Credit Card Number*</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="credit_card_number" maxlength="50" size="30">
 
 </td>
 
</tr>
<tr>
 
 <td valign="top"">
 
  <label for="credit_card_expiration"> Credit Card Expiration (MM/YY)*</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="credit_card_expiration" maxlength="5" size="10">
 
 </td>
 
</tr>
<tr>
 
 <td valign="top">
 
  <label for="comments">Comments *</label>
 
 </td>
 
 <td valign="top">
 
  <textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
 
 </td>
 
</tr>
<tr>
 
 <td colspan="2" style="text-align:center">
 
  <input type="submit" value="Submit"> 
 
 </td>
 
</tr>
 
</table>
 
</form>

And here is the PHP file that handles the request:
 

<?php
$full_name = $_POST['full_name'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$day = $POST['day'];
$month = $POST['month'];
$time = $_POST['time'];
$how_many = $POST['how_many'];
$type = $POST['type'];
$credit_card_number = $_POST['credit_card_number'];
$credit_card_expiration = $_POST['credit_card_expiration'];
$comments = $_POST['comments'];
$formcontent="From: $name \n phone number: $telephone Date of massage: $month $day @ $time for $how_many individual(s). They'd like a $type massage. Credit card number is: $credit_card_number which expires $credit_card_expiration Message: $comments";
$recipient = "vk1@Gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

Thanks in advance for any type of help.

the following forum post addresses much of what you should be doing in your code - http://forums.phpfreaks.com/topic/296742-hello-pretty-simple-php-form-i-broke-itplease-assist/?hl=%2Bsending&do=findComment&comment=1513725

 

pay particular attention to item #8 (the smiley) about the From: email header.

 

edit: i also notice that you have $POST used in some of your code. it's $_POST. if you had php's error_reporting set to E_ALL and display_errors set to ON, you would be getting undefined error messages alerting you to the incorrect variable names.

Edited by mac_gyver

Thanks so much for the response. I wasn't sure why $_POST and $POST were different from each other, as I basically just copied this script from "how to do it" site and then customized. I've already fixed the other stuff with posting and sending through the settings on my server (option number eight). So, unless it magically got undone somehow, it should be okay. Thanks so much for the input and for the link. :-)

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.