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

    Sending Email and radio buttons.

    Ok, so now my script is preforming to par except for one thing. It's supposed to send e-mail to the admin and the person registering. When the Payment option is 'PayPal' Checked, the e-mail doesn't send. if 'cheque' is chwcked, the e-mail sends, curious... I never put in any conditionals that ever question whether an e-mail should be sent or not as it gets sent right before you see the Payment Page and by this point everything should be ok. Why would this be happening?

    Code can be seen at:

    http://www.spanishmania.ca/siregisterftest.php

    html form can be seen at:

    http://www.spanishmania.ca/siregisterftest.html

    txt version of php script can be seen at:

    http://www.spanishmania.ca/siregisterftest.txt

    Thanks for any help,
    Titanic_Fanatic

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    I copied your code to my own test site and tried it-- worked for me with both paypal and cheque. So I dunno why you'd be having a problem.

    Just an FYI, you can print an entire array using the print_r() function, instead of listing every variable in the array (as you've done in your Debug function). You can just do print_r($_POST). You should use the <pre> tag to make it readable.
    PHP Code:
    print "<PRE>\n";
    print_r($_POST);
    print 
    "</PRE>\n"
    One more FYI, you can use a loop to copy the $_POST array to the $_SESSION array, instead of doing each array element separately.
    PHP Code:
    foreach ($_POST as $pKey => $pVal) {
        
    $_SESSION[$pKey] = $pVal;

    And one more nag for you ... it's bad practice to code associative array elements without using quotes. For example, $_SESSION[PaymentType] is not good; even though it works, you should use $_SESSION['PaymentType'] instead. The PHP manual explains what the difference is and why this is important. Here's the link. (Look for the section titled "Array do's and dont's".)

  • #3
    New Coder
    Join Date
    Jul 2005
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I really don't understand what's going on here... I tried to change the radio buttons to a dropdown and now I don't get any mail at all... What could be causing this... I don't understand... Any other Ideas...

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    It's not your code... like I said it worked for me. Perhaps you should look into your PHP configuration and make sure it's ok.

  • #5
    New Coder
    Join Date
    Jul 2005
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did a little more investigating, and I found that when I commented out this line:

    $headers = 'MIME-Version: 1.0' . "\n";

    The mail sends fine, if I uncomment it, it doesn't send the e-mail when the paypal option is selected...

    Do you know why this line would have anything to do with the mail not being sent?

  • #6
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    I'm not smart about email types and mime types and server configs etc.. that's where it seems your problem lies. Is your PHP on a windows or a unix/linix machine? The PHP manual suggests there are significant differences between the two when it comes to email.

    You may want to revert to plain text email to make sure it works 100% of the time.

    I really don't see how the radio button has anything to do with the success of sending the email.

    Can you find the email logs? There may be error messages in there that can give you a clue what's going on.

  • #7
    Regular Coder
    Join Date
    Dec 2004
    Location
    Manchester, UK
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fumigator
    I really don't see how the radio button has anything to do with the success of sending the email.
    I do. If the mail was bordering on being cast as spam by a spam checker, making the email 100% HTML would likely push it over the limit. Pure HTML emails get penalized by spam checkers. You should try to make your emails multipart so that they have a plain text part too. Just make sure the plain text part has the same content as the HTML part... spam checkers do check this too.

    If you need a way to make multipart emails you can use the library in my signature, or there are other classes out there... but not as good :P (PHPMailer is the one people were previously using, but it hogs resources and runs slowly as well as not implementing a lot of SMTP stuff. The Symfony project are to replace PHPMailer with Swift Mailer).


  •  

    Posting Permissions

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