PDA

View Full Version : Total Noob Question



miggsy007
10-19-2004, 08:48 AM
Hi all. I am very new to PHP and I am trying to make an email form. It works fine, I just have one problem that is probably really easy to sort out.



<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['notes'] ;

mail( "example@hotmail.com", "Email Form",
$message, "From: $email" );
header( "Location: http://www.example.co.uk/thanks.html" );
?>


OK, this sends 'notes' to example@hotmail.com with a subject of 'Email Form' then redirects the viewer to the thanks page. It works fine. But I have some more info I need to send too, 'page' and 'name'. How can I add them to the email message that is sent?

Again, I know this is probably a totally stupid question, but I can't find the answer anywhere.

Thanks,

Miggsy007

miggsy007
10-19-2004, 08:59 AM
Oh, and if anyone can recommend a good tutorial to begin learning this sort of thing myself, I'd be very greatful. Most of the stuff I've found on the web so far is a bit complicated.

Cheers,

Miggsy007

melissa820
10-19-2004, 08:34 PM
<?
$email = $_REQUEST['email'] ;

//create the message string by appending various parts to it with .=

$message = "Notes: ";
$message .= $_REQUEST['notes'];
$message .= "\n Page: ";
$message .= $_REQUEST['page'];
$message .= "\n Name: ";
$message .= $_REQUEST['name'];

mail( "example@hotmail.com", "Email Form", $message, "From: $email" );
header( "Location: http://www.example.co.uk/thanks.html" );
?>

Spookster
10-19-2004, 11:13 PM
Hi all. I am very new to PHP and I am trying to make an email form. It works fine, I just have one problem that is probably really easy to sort out.




Please read our posting guidelines before creating any more threads

http://www.codingforums.com/postguide.htm

dswimboy
10-20-2004, 04:06 AM
i think Spookster meant to use a more descriptive title next time.
he should have added that no question is a stupid question. we were all once newbies too. luckily, you discovered this forum as a newbie. i, on the other hand, find myself helping others more.

anyway, i think melissa820 answered your question. if not, i'm sure a google search for php mail form would do it.

miggsy007
10-20-2004, 08:59 AM
Thanks mellisa, that works perfectly.

Of course I read the posting guidelines :(

OK, no I didn't. Sorry. Even managed to make my title exactly the same as one on the bad examples list. Whoops. Won't do it again.

Cheers,

Miggsy007