Hi People, I wonder if I can pick your brains...
Firstly I've never coded in PHP before so this is all new to me...
I need a simple form filled out online, that can be submitted.
I came up with this; but its not working, no mail, no nothing!
please help!
Code:
<form id="rwform" class="contactform" method="post" action="sendmail.php">
<div id="contactform">
<label for="name">Name</label>
<input type="text" name="name" id="user" value="" />
</div>
<div id="contactform">
<label for="address">Address</label>
<input type="text" name="address" id="user" value="" />
</div>
<div id="contactform">
<label for="telephone">Telephone</label>
<input type="text" name="telephone" id="user" value="" />
</div>
<div id="contactform">
<label for="email">Email Address:</label>
<input type="text" name="email" id="emailaddress" value="" />
</div>
<div id="contactform">
<label for="enquiry">Enquiry:</label>
<textarea name="enquiry" id="enquiry" rows="5" cols="25"></textarea>
</div>
<div id="contactform">
<label for="hearaboutus">How did you hear about us?</label>
<input type="checkbox" name="websearch" /> Web Search<br />
<input type="checkbox" name="recommended" class="threepxfix" /> Recommended<br />
<input type="checkbox" name="mag_ad" class="threepxfix" /> Magazine Advert<br />
<input type="checkbox" name="flyer" class="threepxfix" /> Flyer<br />
</div>
<div style="margin-left: 150px;">
<input type="submit" value="Submit" /> <input type="reset" value="reset" />
</div>
</form>
PHP
Code:
<?php
$_POST = array_map('strip_tags', $_POST);
$name = $_REQUEST['name'] ;
$address = $_REQUEST['address'] ;
$telephone = $_REQUEST['telephone'] ;
$email = $_REQUEST['email'] ;
$enquiry = $_REQUEST['enquiry'] ;
$websearch = $_REQUEST['websearch'] ;
$recommended = $_REQUEST['recommended'] ;
$mag_ad = $_REQUEST['mag_ad'] ;
$flyer = $_REQUEST['flyer'] ;
mail("myaddress@mail.co.uk", "Web Enquiry Contact", "From: $email", $name, $address, $telephone, $enquiry, $websearch, $recommended, $mag_ad, $flyer);
header( "Location: http://www.example.com/thankyou.html" );
?>
Any ideas where I am going wrong...and also how to secure it from spamming?
Many thanks!!!