Re: Problem with code...
| From: | George Langley | Date: | Fri, 07 Oct 2011 01:04:39 +0000 |
| Subject: | Re: Problem with code... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-315157@lists.php.net to get a copy of this message | ||
On 2011-10-06, at 6:28 PM, Jason Pruim wrote:
>
> <?PHP
>
> //SETUP VARIABLES
>
> $mailTo = "lists@pruimphotography.com";
> $mailFrom = "lists@pruimphotography.com";
> //These 2 can be changed IF you know what you are doing and why!
> $returnPath = $mailFrom;
> $replyTo = $mailFrom;
> $mailSubject = "New Convention registration!";
>
> $message = "";
>
> //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!!
>
> $headers = "From: ".$mailFrom."\n";
> $headers .= "Return-Path: ".$returnPath."\n";
> $headers .= "Reply-To: ".$replyTo."\n";
>
> function send_email($mailTo, $mailSubject, $mailMessage, $headers) {
>
>
> if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) {
>
> $message = "Thank you for registering!";
>
> }else {
> echo "There was an issue with your registration.. Please try again later";
> }
>
> }//Close Function
>
>
> if(!empty($errorCount)) {
>
>
> }else {
> //Build Email message
> $mailmessage = "Full Name: " . $_POST['firstname'] . "
> " .. $_POST['lastname'] . "\n\n";
> $mailmessage .= "Address: " . $_POST['address'] .
> "\n\n";
> $mailmessage .= "City, State, Zip: " . $_POST['city'] . "
> " . $_POST['state'] . " " . $_POST['zip'] . "\n\n";
> $mailmessage .= "Phone: " . $_POST['phone'] . "\n\n";
> $mailmessage .= "Email address: " . $_POST['email'] .
> "\n\n";
> if($_POST['affiliation'] == "NFBOther") {
> $mailmessage .= "Chapter Affiliation: " . $_POST['other'] .
> "\n\n";
> }else{
> $mailmessage .= "Chapter Affiliation: " .
> $_POST['affiliation'] . "\n\n";
> }
> if($_POST['person'] =="Other"){
> $mailmessage .= "Who will pick up the ticket? " .
> $_POST['Pfirstname'] . " " . $_POST['Llastname'] . "\n\n";
>
> }else{
> $mailmessage .= "Who will pick up the ticket? I will pick it up my self!
> \n\n";
>
> }
>
> $mailmessage .= "Payment Method: " . $_POST['paymentMethod'];
>
> send_email($mailTo, $mailSubject, $mailmessage, $headers);
> }
>
> ?>
>
> Sometimes... It is dropping the last $mailmessage line... The payment method in the actual
> email it sends...
>
> Anyone have any ideas? I'm stumped....
------------
Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it
doesn't exist, will the line still get added?
I would always check to see if every post variable isset, before adding the line. Can write a
default line in its place if missing.
George Langley
Interactive Developer
"RIP, Mr. Jobs."