Sunday, December 27, 2009

Need help with php coding?

Now i have php coded my form and when i click submit it e-mails an error message. I have included the error message and the php code please see if you can find the error.





Error message:





Note: Forwarded message is attached.





The original message was received at Sun, 23 Aug 2009 19:19:00 -0700 (PDT)


from root@localhost





----- The following addresses had permanent fatal errors -----


$pfw_email_to


(reason: 550 5.1.1 %26lt;$pfw_email_to@yahoo-inc.com%26gt;... User unknown)


(expanded from: $pfw_email_to)





----- Transcript of session follows -----


... while talking to mrin4-b.corp.re1.yahoo.com.:


%26gt;%26gt;%26gt; DATA


%26lt;%26lt;%26lt; 550 5.1.1 %26lt;$pfw_email_to@yahoo-inc.com%26gt;... User unknown


550 5.1.1 $pfw_email_to... User unknown


%26lt;%26lt;%26lt; 503 5.0.0 Need RCPT (recipient)


Reporting-MTA: dns; p4db2.geo.re4.yahoo.com


Arrival-Date: Sun, 23 Aug 2009 19:19:00 -0700 (PDT)





Final-Recipient: RFC822; $pfw_email_to@p4db2.geo.re4.yahoo.com


X-Actual-Recipient: RFC822; $pfw_email_to@yahoo-inc.com


Action: failed


Status: 5.1.1


Remote-MTA: DNS; mrin4-b.corp.re1.yahoo.com


Diagnostic-Code: SMTP; 550 5.1.1 %26lt;$pfw_email_to@yahoo-inc.com%26gt;... User unknown


Last-Attempt-Date: Sun, 23 Aug 2009 19:19:00 -0700 (PDT)








-----Inline Message Follows-----





$pfw_header





$pfw_message





PHP codeing:





%26lt;?php


// Receiving variables


@$firstname = addslashes($_POST['firstname']);


@$email = addslashes($_POST['email']);


@$lastname = addslashes($_POST['lastname']);


@$phone = addslashes($_POST['phone']);


@$address = addslashes($_POST['address']);


@$city = addslashes($_POST['city']);


@$state = addslashes($_POST['state']);


@$country = addslashes($_POST['country']);


@$pricerange = addslashes($_POST['pricerange']);


@$pricerangeeuro = addslashes($_POST['pricerangeeuro']);


@$pricerangepound = addslashes($_POST['pricerangepound']);


@$adult = addslashes($_POST['adult']);


@$teen = addslashes($_POST['teen']);


@$children = addslashes($_POST['children']);


@$senior = addslashes($_POST['senior ']);


@$Departurecity = addslashes($_POST['Departurecity']);


@$Destinationcity = addslashes($_POST['Destinationcity']);


@$othercity = addslashes($_POST['othercity']);


@$dparturemonth = addslashes($_POST['dparturemonth']);


@$departuredate = addslashes($_POST['departuredate']);


@$departureyear = addslashes($_POST['departureyear']);


@$returnmonth = addslashes($_POST['returnmonth']);


@$returndate = addslashes($_POST['returndate']);


@$returnyear = addslashes($_POST['returnyear']);


@$addtlmonth = addslashes($_POST['addtlmonth']);


@$addtldate = addslashes($_POST['addtldate']);


@$addtlyear = addslashes($_POST['addtlyear']);


@$rentalcar = addslashes($_POST['rentalcar']);


@$cruise = addslashes($_POST['cruise']);


@$otherinfo2 = addslashes($_POST['otherinfo2']);


@$terms = addslashes($_POST['terms']);


@$service = addslashes($_POST['service']);


@$billingcurency = addslashes($_POST['billingcurency']);





// Validation


//Sending Email to form owner


# Email to Owner


$pfw_header = ';From: $email';;


$pfw_subject = ';form';;


$pfw_email_to = ';clay@ctwtravel.com';;


$pfw_message = ';firstname: $firstname\n';


. ';email: $email\n';


. ';lastname: $lastname\n';


. ';phone: $phone\n';


. ';address: $address\n';


. ';city: $city\n';


. ';state: $state\n';


. ';country: $country\n';


. ';pricerange: $pricerange\n';


. ';pricerangeeuro: $pricerangeeuro\n';


. ';pricerangepound: $pricerangepound\n';


. ';adult: $adult\n';


. ';teen: $teen\n';


. ';children: $children\n';


. ';senior : $senior \n';


. ';Departurecity: $Departurecity\n';


. ';Destinationcity: $Destinationcity\n';


. ';othercity: $othercity\n';


. ';dparturemonth: $dparturemonth\n';


. ';departuredate: $departuredate\n';


. ';departureyear: $departureyear\n';


. ';returnmonth: $returnmonth\n';


. ';returndate: $returndate\n';


. ';returnyear: $returnyear\n';


. ';addtlmonth: $addtlmonth\n';


. ';addtldate: $addtldate\n';


. ';addtlyear: $addtlyear\n';


. ';rentalcar: $rentalcar\n';


. ';cruise: $cruise\n';


. ';otherinfo2: $otherinfo2\n';


. ';terms: $terms\n';


. ';service: $service\n';


. ';billingcurency: $billingcurency\n';


. ';firstname: $firstname\n';


. ';email: $email\n';


. ';lastname: $lastname\n';


. ';phone: $phone\n';


. ';address: $address\n';


. ';city: $city\n';


. ';state: $state\n';


. ';country: $country\n';


. ';pricerange: $pricerange\n';


. ';pricerangeeuro: $pricerangeeuro\n';


. ';pricerangepound: $pricerangepound\n';


. ';adult: $adult\n';


. ';teen: $teen\n';


. ';children: $children\n';


. ';senior : $senior \n';


. ';Departurecity: $Departurecity\n';


. ';Destinationcity: $Destinationcity\n';


. ';othercity: $othercity\n';


. ';dparturemonth: $dparturemonth\n';


. ';departuredate: $departuredate\n';


. ';departureyear: $departureyear\n';


. ';returnmonth: $returnmonth\n';


. ';returndate: $returndate\n';


. ';returnyear: $returnyear\n';


. ';addtlmonth: $addtlmonth\n';


. ';addtldate: $addtldate\n';


. ';addtlyear: $addtlyear\n';


. ';rentalcar: $rentalcar\n';


. ';cruise: $cruise\n';


. ';otherinfo2: $otherinfo2\n';


. ';terms: $terms\n';


. ';service: $service\n';


. ';billingcurency: $billingcurency\Need help with php coding?
Your code got cut short, but obviously the code is trying to send out the email. Closest thing I can identify is that the variable is being treated as a string when you call the mail function. Most common cause of this strange behavior are missing end quotes or mismatch single/double quotes. Also insure that the end of a string is terminated with a ';;';.





First, either remove this line


# Email to Owner





or change it to


// Email to Owner.





If that doesn't fix it, move the line where you assign pfw_email_to to the top of the script.





Another thing to consider is that depending on where it is hosted, embedding php variables in double quotes may not always work - this is called a magic quotation, and to be safe, I always use the format...


$some_var = ';some string ';.$some_value;





But magic quotes is a pretty common setting.





Good luck.





Paul Wolborsky


http://www.ajaxofalltrades.com

No comments:

Post a Comment