I have this working almost how I want, just need to add in some validation for the text areas. However there is a problem that exists, when you first go to the page you will see a feedback message despite having done nothing...I dont understand why this is happening or how to remove it.
www.warfinder.co.uk
www.warfinder.co.uk
Code:
<div class="small-content-middle">
<form id="form_message" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
<input type="text" name="name" value="Enter Name"> <br /><br />
<textarea rows="6" cols="24" name="message">Enter Your Message
</textarea>
<br/><br/><?php
$error_msg = "hello";
$to = "[email protected]";
$name = $_POST['name'];
$subject = "Queen's Radio Message From " . $name;
$txt = $_POST['message'];
if (mail($to,$subject,$txt))
{
$error_msg = '<font color="#FF0000">*Message Sent</font>';
}
else
{
$error_msg = '<font color="#FF0000">*Message Failed</font>';
}
echo $error_msg ?><br/>
<input type="submit" value="Submit">
</form>
</div>