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 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    89
    Thanks
    2
    Thanked 0 Times in 0 Posts

    problems with email

    Hello all,

    I have some code below that creates an email from a web form :

    PHP Code:
    <?php
    // create the email message

    $msg .= "Please create this account and credit it with $10 \n\n\n";

    $msg .= "ACCOUNT DETAILS \n\n";

    if (
    $nickname != "") {
         
    $msg .= "Nick Name : $nickname\n";
         }
    if (
    $username != "") {
         
    $msg .= "User Name : $username\n";
         }
    if (
    $password != "") {
         
    $msg .= "Password : $password\n\n";
         }
    $msg .= "Personal DETAILS \n\n";

    if (
    $from != "") {
         
    $msg .= "First Name : $from\n";
         }
    if (
    $middlename != "") {
         
    $msg .= "Middle Name : $middlename\n";
         }
    if (
    $lastname != "") {
         
    $msg .= "Last Name : $lastname\n";
         }
    if (
    $dateofbirth != "") {
         
    $msg .= "Date of Birth : $dateofbirth\n";
         }
    $msg .= "Address : $address\n";

    if (
    $town != "") {
         
    $msg .= "Town : $town\n";
         }
    if (
    $postcode != "") {
         
    $msg .= "Postcode : $postcode\n";
         }
    if (
    $county != "") {
         
    $msg .= "County : $county\n";
         }
    if (
    $country != "") {
         
    $msg .= "Country : $country\n";
         }
    if (
    $telephone != "") {
         
    $msg .= "Telephone : $telephone\n";
         }
    if (
    $email != "") {
         
    $msg .= "Email : $email\n";
         }

    if (
    $bigslickprivate != "") {
         
    $msg .= "Join the Big Slick Private Members club? : $bigslickprivate\n";
         }
    if (
    $bigslickplayers != "") {
         
    $msg .= "Join the Big Slick Players Club? : $bigslickplayers\n";
         }
    if (
    $bigslickpreffered != "") {
         
    $msg .= "Obtain membership to Big Slick's preferred members club? : $bigslickpreffered\n\n";
         }
    $msg .= "Sent : $today\n";

    $mailheaders "Poker account registration ( $username ) \n";

    $mailheaders "From: $email"


    mail($to$subject$msg$mailheaders);

    I am trying to have the users email address (the person who has just filled out the form) appear in the "from" field, but the webserver seems to fill in its own address.

    here is how I have the from address set up :

    PHP Code:
    $mailheaders "From: $email"
    the $email variable is populated from a form field. Any Ideas how to do this?

    Thanks

  • #2
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts
    are you setting the $email var correctly?

    PHP Code:
    //If its from a POST method form
    $email $_POST['email'];

    //if its in the url (GET method)
    $email $_POST['email']; 

    EDIT:
    also... whats all this about:
    PHP Code:
    $mailheaders "Poker account registration ( $username ) \n"
    didnt you mean
    PHP Code:
    $subject "Poker account registration ( $username ) \n"
    ???

    or to be more syntax correct...
    PHP Code:
    $subject "Poker account registration ( " $username " ) \n"
    Last edited by goughy000; 05-02-2006 at 06:55 PM.
    PHP Freelancing!
    ByteForums!
    Scriptlance.comNeed a job done quick? post it on scriptlance! OR! your a programmer? sign up and get paid for these jobs!


  •  

    Posting Permissions

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