Jump to content
xisto Community
Sign in to follow this  
green fairy

Need Help With An Emailform

Recommended Posts

I'm quite new to php and I have just made myself an email form what I can't make work for some reason. Could anyone who knows phph perhaps tell me what I am doing wrong?

<html>
<head>
<title>Contact</title>
</head>

<body>

<h1>Contact:</h1>

If you need to contact the webmistress, please use this form (enter all fields):
<form action="sendmail.php" method="post">

<table border=0 cellspacing=3 height="231">
<tr valign=top>


<td height="25">Your name:</td><td height="25"><INPUT type="text" name="name" size="25"></td></tr>
<tr><td height="25">Your email:</td><td height="25"><INPUT type="text" name="email" size="25"></td></tr>
<tr><td height="25">Subject:</td><td height="25"><INPUT type="text" name="subject" size="25"></td></tr>


<tr><td colspan=2 height="130">
<textarea name="message" rows=7 cols=30>Add your questions, comments, suggestions or feedback.</textarea>
</td></tr>
<tr>
<td height="27">

<input type="submit" name="submit" value=" Send ">
</td></tr></table><br>

</form>


<?
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;

if (empty($name) || empty($email) || empty($subject) || empty($message)) {

header ( "Expires: Mon, 20 Des 1998 01:00:00 GTM" );
header ( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GTM" );
header ( "Cache-Control: no-cache, must-revalidate" );
header ( "Pragma: no-cache" );

?>

<h2>Error!</h2>
<p>
Oops, it appears you forgot to enter some fields. Please try again.
</p>

<?
}
else {
mail( "nkf.webmistress@gmail.com", "$subject, $message, "From: $name <$email>" );
?>

<h2>Thank you!</h2>
<p>Your message has now been sent!</p>

<?
}
?>

</body>

</html>


Share this post


Link to post
Share on other sites

Actually, I have just the thing for you! snlildude wrote this tutorial a while ago.

It's extremely simple, just edit the email "To" fields so it's sent to your email and not his(lol). You can edit the message that the people see once they click "Sumbit" other that that, you shouldn't need to edit anything else.
Hope that helps.

Share this post


Link to post
Share on other sites

I was going to suggest my email tutorial. :rolleyes:Anyway, if you're set on using your script, please tell us what's happening so we can figure it out. Also, you can try to edit your script after reading my tutorial, so that it's similar to mine.I do have one thing to say when I was scanning your script...change all the "$_REQUEST"s to "$_POST".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.