help sending php email via a form
Posted: Tue Aug 21, 2007 10:04 am
feyd | Please use
which points to a process.php file with the following code[/syntax]
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
this is my first attempt at using php in my web pages and i've been trying to include a simple form section which sends me an email & displays a message on submitting. i just can't get this to work - i just get a blank page in the browser with no message & no email is sent.
please let me know where i'm going wrong.
[b]Form html is as follows:[/b]
[syntax="html"]<form action="process.php" method="post" name="form1" id="form1">
<textarea name="message" cols="30" rows="5" id="message"></textarea>
<input type="submit" name="Submit" value="Send Message" />
</form>Code: Select all
<?php
$sender_msg=$_POST['message'];
$to = "dstyler@freeuk.com";
$message = $sender_msg;
if(mail($to, $message)
{
echo "<h3>Your message has been successfully sent.</h3>";
echo "We will reply to you in due course.<br /><br />";
echo "King regards,<br /> <i>The administration</i>";
}
else
{
echo "<h3>Error sending your message.</h3>";
echo "We apologyse for the error occured.<br />Please try again later or contact the adminitrator using alternative methods. <br />";
echo "Thank you for your understanding.<br /><br /> <i>The administration</i>";
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]