Hi,
I wonder if anyone could help me. I am fairly new to web development and I am trying to set up a contact form using html and php.
the codes are:
PHP Code:
<form action="sendmail.php" method="post" name="contact form" id="contact form" title="contact form"> <div id="customer"> <h3>Your Details</h3> <p>Name : <input name="Name" type="text" id="Name" accesskey="n" tabindex="1" title="Name" size="33" maxlength="33" /> </p> <p>E-mail Address : <input name="Email" type="text" id="Email" accesskey="e" tabindex="2" title="Email" size="33" maxlength="50" / > </p> <p>Phone Number : <input name="Phone" type="text" id="Phone" accesskey="p" tabindex="3" title="Phone" size="33" maxlength="33" /> </p> </div> <div id="vehicle"> <h3>Vehicle Information</h3> <p>Year : <input name="Year" type="text" id="Year" accesskey="y" tabindex="4" title="Year" size="33" maxlength="4" /> </p> <p>Make : <input name="Make" type="text" id="Make" accesskey="m" tabindex="5" title="Make" size="33" maxlength="33" /> </p> <p>Model : <input name="Model" type="text" id="Model" accesskey="o" tabindex="6" title="Model" size="33" maxlength="33" /> </p> </div> <div id="problem"> Description of Problem : <textarea name="Problem" cols="65" rows="3" id="Problem" accesskey="p" tabindex="6" title="Problem">Please describe the problem here ...</textarea> </div> <div id="submit"> <input name="Reset" type="reset" id="Reset" accesskey="r" tabindex="8" title="Reset" /> <input name="Submit" type="submit" id="Submit" accesskey="s" tabindex="7" title="Submit" /> </div> </form>
<?php if(isset($_POST['submit'])) {
$to = "enquiries@bexhillgearboxes.com"; $subject = "Message from your website"; $name_field = $_POST['Name']; $email_field = $_POST['Email']; $phone_field = $_POST['Phone']; $year_field = $_POST['Year']; $make_field = $_POST['Make']; $model_field = $_POST['Model']; $problem_field = $_POST['Problem']; $body = "From: $name_field\n E-Mail: $email_field\n Phone_number:\n $phone_field\n Year: $year_field\n Make: $make_field\n Model: $model_field\n Problem: $problem_field\n"; echo "Your message has been submitted to $to! we will endeaver to get back to you as soon as possible"; mail($to, $subject, $body);
} else {
echo "Your message has not been sent, please try again or contact us via phone or e-mail!";
} ?>
I have uploaded these files to my server, but when I test the form it always returns the message not sent option.
Is there something obvious I am doing wrong?
Thanks for any help people can offer
Last edited by chrishirst; 03-05-2009 at 07:23 AM..
|