mardi 31 mars 2015

Form not sending, directs to php file but does does nothing

I have a contact form on a site and use php to send the message, I took the php file from another site I created and changed it to suite the needs of this site which is why I don't see where the problem is, it worked fine on the other site. The PHP is here:



<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Submitting...</title>

</head>

<body>

<?php
$name = $_POST ['name'];
$company = $_POST['company'];
$phone_number = $_POST['phone_number'];
$email = $_POST['email'];
$client = $_POST['current-client'];
$office = $_POST['office'];
$enquiry = $_POST['enquiry'];
$formcontent = "Name: $name
\n Company: $company
\n Phone Number: $phone_number
\n Email: $email
\n Client: $client
\n Office: $office
\n Enquiry: $enquiry";
$recipient = "tristan.dyas@gmail.com";
$subject = "$office Website contact";
$mailheader = "From: $email \r\n";
ini_set("sendmail_from","tristan.dyas@gmail.com");
mail($recipient, $subject, $formcontent, $mailheader) or die("Please try again.");
echo "Form Submitted.";
header("Location: http://ift.tt/19vntly");
?>

</body>
</html>


And the html:



<div id="contact_form_container">
<form id="contact_form" name="contact_form" method="post" action="mail.php">
<table width="" align="center" border="0">
<tr>
<td colspan="3" align="center" style="height: 4.0em;">&nbsp;</td>
</tr>
<tr>
<td class="label-cell"><label for="name">Full Name*</label></td>
<td>&nbsp;</td>
<td class="label-cell"><label for="company">Company Name (If Applicable)</label></td>
</tr>
<tr>
<td width="145"><input type="text" name="name" id="name" class="text" /></td>
<td width="25" rowspan="8">&nbsp;</td>
<td width="145"><input type="text" name="company" id="company" class="text" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="label-cell"><label for="email">Email Address*</label></td>
<td class="label-cell"><label for="phone_number">Phone Number*</label></td>
</tr>
<tr>
<td><input type="email" name="email" id="email" class="text" /></td>
<td><input type="number" name="phone_number" id="phone_number" class="text" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="label-cell"><label for="current-client">Current Client?*</label></td>
<td class="label-cell"><label for="office">Office (If Applicable)</label></td>
</tr>
<tr>
<td><select name="current-client" id="current-client-drp" class="dropdown-select">
<option selected>Please Select...</option>
<option>Yes, current client</option>
<option>No, not a client</option>
<option>No, previous client</option>
</select></td>
<td><select name="office" id="office-drp" class="dropdown-select">
<option selected>Please Select...</option>
<option>Cotteridge</option>
<option>Handsworth</option>
<option>Solihull</option>
<option>Grimsby</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><label for="enquiry">Message:</label></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><textarea name="enquiry" id="enquiry"></textarea></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><input name="submit" type="submit" id="submit" form="contact_form" formaction="mail.php" formenctype="multipart/form-data" formmethod="POST" formtarget="_self" title="Submit" value="Submit"></td>
</tr>
</table>
</form>
</div>


When I fill out the form and hit submit, it goes to the sending page, but just sits there and does nothing. The message does not send either. It's a simple form, I have checked and double checked but I am not great with PHP, I focus more on HTML and CSS so this is a little outside my comfort zone. Any help will be greatly appreciated.


Aucun commentaire:

Enregistrer un commentaire