New to php and need very basic help with mail forms
Posted: Mon Jul 14, 2008 11:16 pm
Hey guys,
I started learning php about 6 hours ago and tried to put together a basic mail script but can't get it to work. I was hoping that someone a little more php savvy than myself could help me out. The code I have on my index.html page is:
<form method="post" action="sendmail.php">
Email: <input type="text" name="newemail">
<input type="submit">
</form>
Then I created a file named sendmail.php which looks like this:
<?php
$ForwardTo="mail@hotmail.com";
$email = $ REQUEST['newemail'];
mail($ForwardTo, "Email Subscribers", "From: $email");
header("Location: thankyou.html");
?>
with the email address obviously different. When I try out the form and click the submit button I get redirected to a 'page not found' page and the submitted info doesn't go through to the specified email account. Any advice?
I started learning php about 6 hours ago and tried to put together a basic mail script but can't get it to work. I was hoping that someone a little more php savvy than myself could help me out. The code I have on my index.html page is:
<form method="post" action="sendmail.php">
Email: <input type="text" name="newemail">
<input type="submit">
</form>
Then I created a file named sendmail.php which looks like this:
<?php
$ForwardTo="mail@hotmail.com";
$email = $ REQUEST['newemail'];
mail($ForwardTo, "Email Subscribers", "From: $email");
header("Location: thankyou.html");
?>
with the email address obviously different. When I try out the form and click the submit button I get redirected to a 'page not found' page and the submitted info doesn't go through to the specified email account. Any advice?