SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast GlennB's Avatar
    Join Date
    Jul 2003
    Location
    Langley, B.C., Canada
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Mail code won't work?

    I'm trying to get my refer site to a friend to work. Can anyone see what i've done wrong in my code. I'm not recieving the email. Thanx for your help!

    PHP Code:

     $Email 
    $HTTP_POST_VARS['Email'];
     
    $Name $HTTP_POST_VARS['Name'];
     
    $FriendEmail1 $HTTP_POST_VARS['FriendEmail1'];
     
    $FriendEmail2 $HTTP_POST_VARS['FriendEmail2'];
     
    $FriendEmail3 $HTTP_POST_VARS['FriendEmail3'];
     
    $recsubject 'Garage Sale Canada'
     
    if(!isset(
    $Email)) {
     
    header("location: http://www.garagesalecanada.ca");
     exit(); 
    }

     
    $ThankyouURL 'recommendthankyou.htm'
     
    $yoursubject 'Garage Sale Canada';  

     
    $emailtext '
    ---------------------------------------------------------------------
       Post or view garage sales @ GarageSaleCanada for FREE!
    ---------------------------------------------------------------------
    Hi,
    '
    .$Name.' at '.$Email.' has visited my website at [url]www.garagesalecanada.ca[/url] and thought
    you would like to know about our range of Services.

     - Advertise your garage sale to millions of users across Canada for FREE!
     - Search for garage sales in your area.
     - Chat in our forum.
     - Free resources to help you make the most out of your sale.

    For more information about our services and a free listing, please click the link below:
    [url]http://www.garagesalecanada.ca[/url]

    Kind Regards
    Glenn - Webmaster

    '
    ;

     
    mail('$FriendEmail1'$yoursubject$emailtext'From: $Email');


     
    header("Location: $ThankyouURL");
     exit; 

  2. #2
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try echoing $FriendEmail1, and $Email, to see if, indeed, they contain the values you expect.

    Also, Change the 'From: $Email', to 'From: $Email <$Email>\r\n'
    My name is Steve, and I'm a super-villian.

  3. #3
    SitePoint Enthusiast GlennB's Avatar
    Join Date
    Jul 2003
    Location
    Langley, B.C., Canada
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm ya thats the problem it's not receiving the info from my form.
    I've simplified it and have one firld in a form and submitting it to a php page and trying to echo the results back.

    Heres the form
    HTML Code:
      <form action="test.php" method="post" name="" id="">
        <p>
          <input name="FriendEmail1" type="text" id="FriendEmail1" size="50" maxlength="50">
        </p>
        <p>
          <input type="submit" name="Submit" value="Submit">
        </p>
      </form>
    and heres the php its going to

    PHP Code:
    <?php
    $FriendEmail1 
    $HTTP_POST_VARS['$FriendEmail1'];
    echo 
    $FriendEmail1;
    echo 
    'test';
    ?>
    this is so simple what am i doin wrong?

  4. #4
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By using $HTTP_POST_VARS['$FriendEmail1'], you are telling PHP to look for a matching variable named '$FriendEmail1' (With the dollar sign).

    Remove the dollar sign -- you aren't referencing a variable, in the sense of the dollar sign before $HTTP_POST_VARS, but instead an index to an array (actually, a key).

    PHP Code:
    <?php
    $FriendEmail1 
    $HTTP_POST_VARS['FriendEmail1'];
    echo 
    $FriendEmail1;
    echo 
    'test';
    ?>
    My name is Steve, and I'm a super-villian.

  5. #5
    SitePoint Enthusiast GlennB's Avatar
    Join Date
    Jul 2003
    Location
    Langley, B.C., Canada
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Beautiful! That was it! It works now.
    Thanx ALOT!

  6. #6
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by GlennB
    Beautiful! That was it! It works now.
    Thanx ALOT!
    Glad to hear it
    My name is Steve, and I'm a super-villian.


Bookmarks

Posting Permissions

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