im trying to create a feedback form that allows the user to select a recipent from a drop down menu so that once the send button is hit, the email is sent to the persons email address in the list. i have thelist created and have attempted the php handler but it doesnt seem to work. the page loads correctly as if the form has worked (i get the thankyou message) but the email does not send. could anyone please help me?
this is my form code:
<form id="form1" method="post" action="sendmail.php">
<label>
<div align="left"><span class="style1">Councillor:
<select name="emailler" id="councillor">
<option value="cllrckavanagh@sthelens.gov.uk">Carole</option>
<option value="cllrferry@sthelens.gov.uk">Richard</option>
<option value="cllraheyes@sthelens.gov.uk">Anne</option>
<option value="snefmoo@hotmail.com">Stef</option>
</select>
</span></div>
</label>
<p align="left" class="style1">
Your Name:
<input name="Name" type="text" value="" />
</p>
<p align="left" class="style1">Your Email Address:
<input name="Name2" type="text" value="" />
</p>
<p>
<span class="style1">
<label>
Message:
<textarea name="msg" id="msg" cols="45" rows="5"></textarea>
<br />
<br />
<input type="submit" name="send" id="send" value="Submit" />
<input type="reset" name="delete" id="delete" value="Delete" />
</label>
</span>
</form>
and this is my attempt at the php:
<?php
if (isset($_REQUEST['emailler']))
{
$councillor = $_REQUEST['councillor'] ;
$name = $_REQUEST['Name'] ;
$email = $_REQUEST['Name2'] ;
$message = $_REQUEST['msg'] ;
mail( "someone@example.com", "Name: $name",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
{
echo "<form method='post' action='sendmail.php'>
Name: <input name='email' type='text' /><br />
Email: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
it may be something simple that iv missed but iv been trying to fix it for a while now but i just cant see where iv gone wrong and its driving me crazy.
any help would be appreciated.