Hey Guys, did not post the code but here it is now. Oh and basically what is happening is I am now getting and error. The $message variable is what's causing problems. Everything works if I take out the $message. How do I get this to work? Here is the code:

<?php
	include_once("gatewayapi/inc_gatewayapi.php");
	
	$transaction = new GatewayTransaction($_REQUEST, $_SERVER['REMOTE_ADDR']);
	
	if($transaction->ProcessTransaction($responseString, $errorCode))
	{
		$response = new GatewayResponse($responseString, $GatewaySettings['delim_char']);
		
		// Check MD5 Hash Value
		//
		 if($GatewaySettings['MD5Hash'] 
				&& !$response->VerifyMD5Hash($GatewaySettings['MD5Hash'],
														$transaction->username,
														$transaction->amount))
			{
				header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString("INVALID_MD5HASH")));
				exit();
			}
		 	

		
		if($response->IsApproved())
		{
	        $to = 'donation@mysite.org';  
            	$subject = 'New Donation';
            	$header = 'From: no-reply@mysite.org';
                $message = '<html><body>';
                $message .= '<img src="http://mysite.org/images/emailbanner.jpg" alt="Email Banner" />';
                $message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
                $message .= "<head>"
                $message .= "<title>Donation Information</title>"
                $message .= "</head>"
                $message .= "<body>"
                $message .= "<p>Donation Information</p>"
                $message .= "<table>"
                $message .= "<tr>"
                $message .= "<th>Donation Amount:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["amount"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Designation:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["Desc"]; ?></td>"
                $message .= "</tr>"
                $message .= "</table>"
                $message .= "<p>Billing Information</p>"
                $message .= "<table>"
                $message .= "<tr>"
                $message .= "<th>First Name:</th>"
                $message .= "<th>Last Name:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["first_name"]; ?></td>"
                $message .= "<td><?php echo $_GET["last_name"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Spouse Name:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["Spouse"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Address:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["address"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>City:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["city"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>State:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["state"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Zip Code:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["zip"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Country:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["country"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Phone Number:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["phone"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Email Address:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["email"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Credit Card:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $cc_number = "XXXX-XXXX-XXXX-" . substr($cc_number,-4,4); ?></td>"
                $message .= "</tr>"
                $message .= "</table>"
                $message .= "<p>Shipping Information</p>"
                $message .= "<table>"
                $message .= "<tr>"
                $message .= "<th>First Name:</th>"
                $message .= "<th>Last Name:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["shipping_first_name"]; ?></td>"
                $message .= "<td><?php echo $_GET["shipping_last_name"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Address:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["shipping_address"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>City:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["shipping_city"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>State:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["shipping_state"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Zip Code:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["shipping_zip"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Country:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["shipping_country"]; ?></td>"
                $message .= "</tr>"
                $message .= "</table>"
                $message .= "<p>Gift of Love</p>"
                $message .= "<table>"
                $message .= "<tr>"
                $message .= "<th>This gift is:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GiftDesc1"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Is this a pet?</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["IsThisaPet"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>If a pet what kind:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["TypeofPet"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Name:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GiftDesc2"]; ?></td>"
                $message .= "</tr>
                $message .= "<tr>"
                $message .= "<th>Address:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GOLAddress"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>City:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GOLCity"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>State:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GOLState"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Zip:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GOLZip"]; ?></td>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<th>Country:</th>"
                $message .= "</tr>"
                $message .= "<tr>"
                $message .= "<td><?php echo $_GET["GOLCountry"]; ?></td>"
                $message .= "</tr>"
                $message .= "</table>"

            	if (mail($to, $subject, $message, $header)) {
            		header("Location: " . $GatewaySettings['PaymentApprovedPage']);
            	}
		}
		else
			header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
	}
	else
			header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));

?>

Recommended Answers

All 8 Replies

You missed a double quote. see below.
One of the the things you need is a code highlighter.
It showed up like a sore thumb on the forum!

message .= "<td><?php echo $_GET["GiftDesc2"]; ?></td>"
                $message .= "</tr> 
                $message .= "<tr>"
                $message .= "<th>Address:</th>"

Ok awesome thanks JRM. I took your advice and downloaded GeSHi a generic syntax highlighter. Now the only problem after I added the double qoute is that I am getting an error as follows:

Parse error: syntax error, unexpected T_VARIABLE in \\nawinfs02\home\users\web\b885\rh.mysite.com\orderform\process_transaction.php on line 30


Although I believe line 30 is for me is line 27 on this forum.

Ok awesome thanks JRM. I took your advice and downloaded GeSHi a generic syntax highlighter. Now the only problem after I added the double qoute is that I am getting an error as follows:

Parse error: syntax error, unexpected T_VARIABLE in \\nawinfs02\home\users\web\b885\rh.mysite.com\orderform\process_transaction.php on line 30


Although I believe line 30 is for me is line 27 on this forum.

Better than Geshi, why not just get an open source IDE that does PHP? Netbeans and Eclipse are popular.
You left off a boat load of semicolons.

commented: JRM has helped me a bunch! +1

First off, downloaded Netbeans and it is really cool. Haha and yeah you're right I did leave out alot! I wasn't sure if I was supposed to put them there. No wonder it is not working. Thanks again ill try that.

Better than Geshi, why not just get an open source IDE that does PHP? Netbeans and Eclipse are popular.
You left off a boat load of semicolons.

Ok, you have several lines like this:

$message .= "<td><?php echo $_GET["shipping_address"]; ?></td>"

.
That's completely invalid. You need to do this:

$message .= "<td>{$_GET['shipping_address']}</td>";

I have no idea what you think you're doing, but if you put "<?php echo" within a string, that's exactly what will go in the string. Then you have double-quotes around the array item. If you have a double-quote, it breaks out of the string quotes. Either change them all to the above, or use concatenation like this:

$message .= "<td>" . $_GET['shipping_address'] . "</td>";

You have to change that for every single place where you made the error.
Also, I would suggest that you use the POST method for a form as large as this one (if possible).

It's not even funny how many problems with your syntax there are! You don't even have semi-colons after every line!
Every single time you use $message .= something you must have a semicolon (;) at the end of the line.


Here's an even better suggestion: instead of using so many lines of concatenating, combine everything into one long string with HEREDOC.
Just remember that every time you want to insert a variable, and that variable is in an array, you need to place curly braces ({ and }) around the variable.


Man, read some tutorials! Lines like this are simply rediculous:

$message .= "<td><?php echo $cc_number = "XXXX-XXXX-XXXX-" . substr($cc_number,-4,4); ?></td>"
commented: Jrail Really Helped me out a bunch! +1

Jerail,

I apologize for my dysfunctional code. I am a beginner when it comes to PHP, but trying to get better. I appreciate your help and the time you took to look over my code. I will try these methods and again thank you so much. Is there any tutorial websites that you would recommend for PHP other than the PHP manual?

Thank you.

The PHP.net site is good if you know what you're looking for, but I would recommend looking over the tutorials at http://w3schools.com/ and http://tizag.com/. You might also like to get a book, since this is often the best way to learn. If you do buy a book, look for PHP v. 6.

Oh ok cool Ill check amazon to see if I can get it used. Thanks

The PHP.net site is good if you know what you're looking for, but I would recommend looking over the tutorials at http://w3schools.com/ and http://tizag.com/. You might also like to get a book, since this is often the best way to learn. If you do buy a book, look for PHP v. 6.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.