Simple PHP script

Discussion in 'PHP' started by primster7, Feb 14, 2009.

  1. #1
    I have this newsletter graphic on my page and it just asks for the person's name and email to subscribe to my newsletter. However, it doesn't send me the persons name and email. It send me a blank email. I blanked out the email portion below for security reasons.

    See my php script:

    <?
    $subject="from ".$_GET['your_name'];
    $headers= "From: ".$_GET['your_email']."\n";
    $headers.='Content-type: text/html; charset=iso-8859-1';
    mail("blanked_out@nowhere.com", $subject, "
    <html>
    <head>
    <title>Contact letter</title>
    </head>
    <body>

    <br>
    ".$_GET['message']."
    </body>
    </html>" , $headers);
    echo ("Your message was successfully sent!");
    ?>



    Any help would be appreciated.
     
    primster7, Feb 14, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    maybe you're sending by POST
    change fields like this
    ".$_POST['your_name'];
    etc
     
    crivion, Feb 14, 2009 IP
  3. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #3
    Never ever use GET for strings longer than 150 chars !!
    Check if you've added GET method to your form, check if your message was passed in the correct way ( with simple echo or print function ).
     
    ActiveFrost, Feb 14, 2009 IP
  4. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Try sending a mail without html tags, just plain texts and see what you get.

    I think you cant send HTML mails using mail()? or I am wrong here.

    Anyway, just give it a try.
     
    ads2help, Feb 14, 2009 IP
  5. xcrox

    xcrox Banned

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I think you can by using proper headers.
     
    xcrox, Feb 15, 2009 IP
  6. primster7

    primster7 Well-Known Member

    Messages:
    801
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    #6
    Can someone please post a simple php script that will send me the persons name and email address?

    I would greatly appreciate it.
     
    primster7, Feb 15, 2009 IP
  7. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
  8. webmoney

    webmoney Well-Known Member

    Messages:
    1,119
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    155
    #8
    webmoney, Feb 16, 2009 IP
  9. vijaybhaskar184

    vijaybhaskar184 Member

    Messages:
    98
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    you could not use $_GET['message'] in a string. Assaign it to a variable and then use it in your email body.
    Thanks,
    vijay
     
    vijaybhaskar184, Feb 16, 2009 IP