Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    Oct 2004
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New Coder
    Join Date
    Oct 2004
    Posts
    64
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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" );
    ?>

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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

  • #5
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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."

  • #6
    New Coder
    Join Date
    Oct 2004
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •