I need a little help with PHP contact form. Every time I submit it I get the error message. Any help is much appreciated: <?php $to = "handy@winnpc.com"; // where the submission go if($_POST['send']) { $name = $_POST['name']; $email = $_POST['email']; $best = $_POST['best_time']; $number = $_POST['number']; $description = $_POST['description']; $best_number = $_POST['best']; $alt = $_POST['alt']; if(!$name || !$email || !$best || !$number || !$description || !$best_number) { echo '<script type="text/javascript">alert("Please ensure all fields are complete");</script>'; echo "<meta http-equiv='refresh' content='0; url=contact.php'>"; }else{ $go++; } if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $go++; } else { echo '<script language="Javascript">alert ("Email is invlalid") </script>'; echo "<meta http-equiv='refresh' content='0; url=contact.php'>"; } $headers = "From: $name <$email>\n"; $headers .= "Reply-To: $name <$email>\n"; $date = date("d/m/y H:s"); if($go==2) { mail($to, "Submission on Handy Mensch", "New message has been posted from $name at $date \n\n Persons Name: $name \n Email: $email \n Best Time to contact: $best \n Best Phone Number: $best_number \n\n Alternate Nuber: $alt \n\n Description: \n $description", $headers); echo "<p style='text-align:center;'>Thankyou $name your message has been sent</p>"; } } ?> <form id="send" method="post" action=""> <table> <tr> <td>Your Name:</td> <td><input name="name" type="text" id="name" /></td> </tr> <tr> <td>Best contact phone number:</td> <td><input name="best" type="text" id="best" /></td> </tr> <tr> <td>Alternate contact phone number:</td> <td><input name="alt" type="text" id="alt" /></td> </tr> <tr> <td>Best Time to Contact:</td> <td><input name="best_time" type="text" id="best_time" /></td> </tr> <tr> <td>Email address:</td> <td><input name="email" type="text" id="email" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="top">Please describe your project need in detail: </td> <td><textarea name="description" id="description" cols="25" rows="5"></textarea></td> </tr> <tr> <td> </td> <td> <p> <label></label> <label> <input type="submit" name="send" id="send" value="Submit" /> </label> </p> </td> </tr> </table> </form> Code (markup):
You don't have a field named "number" on your contact form, so $_POST['number'] and therefore $number are both null.