Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-19-2004, 08:48 AM   PM User | #1
miggsy007
New Coder

 
Join Date: Oct 2004
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
miggsy007 is an unknown quantity at this point
Total Noob Question

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.

Code:
<?
  $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 is offline   Reply With Quote
Old 10-19-2004, 08:59 AM   PM User | #2
miggsy007
New Coder

 
Join Date: Oct 2004
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
miggsy007 is an unknown quantity at this point
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
miggsy007 is offline   Reply With Quote
Old 10-19-2004, 08:34 PM   PM User | #3
melissa820
New Coder

 
Join Date: Oct 2004
Posts: 64
Thanks: 2
Thanked 0 Times in 0 Posts
melissa820 is an unknown quantity at this point
PHP Code:
<?
  $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" );
?>
melissa820 is offline   Reply With Quote
Old 10-19-2004, 11:13 PM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,222
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
Quote:
Originally Posted by miggsy007
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
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 10-20-2004, 04:06 AM   PM User | #5
dswimboy
Regular Coder

 
dswimboy's Avatar
 
Join Date: Nov 2003
Location: mostly in Ann Arbor
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
dswimboy is an unknown quantity at this point
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.
__________________
"There is more than one way to do it."
dswimboy is offline   Reply With Quote
Old 10-20-2004, 08:59 AM   PM User | #6
miggsy007
New Coder

 
Join Date: Oct 2004
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
miggsy007 is an unknown quantity at this point
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
miggsy007 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:12 PM.


Advertisement
Log in to turn off these ads.