Jump to content

Form to email


mytutorisfat

Recommended Posts

Hi guys,

 

I have a simple 3 input html form and I found a tutorial that I understand that in theory should send the data from the form to the email address supplied.  It doesnt seem to do anything thought if anyone could point me in the direction of either a better tutorial, a thread where this kind of thing is discussed (I had no luck when I searched) or even spot any problems in the code your help would be appreciated.

 

<?php

 

  $name = $_REQUEST['name'] ;

  $email = $_REQUEST['email'] ;

  $comments = $_REQUEST['comments'] ;

 

  mail( "insert email here", "Query Form Results",

    $comments, "From: $name", "Email: $email" );

  header( "Location: insert url here" );

?>

 

Thanks in advance

 

Mytutorisfat

Link to comment
Share on other sites

Try this (replace red text with whatever is appropriate for your site):

 

<?php

 

$name = $_REQUEST['name'];

$email = $_REQUEST['email'];

$comments = stripslashes($_REQUEST['comments']);

 

$webmaster = 'you @ email.com';

$subject = 'Your Email Subject';

 

mail($webmaster, $subject, $comments, "From: $name <$email>");

 

header("Location: success.php");

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.