3 Replies - 572 Views - Last Post: 08 February 2010 - 10:17 PM Rate Topic: -----

#1 drewpark88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 08-February 10

PHP Error

Posted 08 February 2010 - 05:07 PM

*Posted with new changes

Hey everyone,

I must have over looked something or I have done something wrong. I have a donation form and a process_transaction.php file that checks to see if a transaction was approved/denied, sends an email to me if approved then redirects the customer to an approval/denied page. There are more files but the process_transaction.php is what is causing problems.


I am getting this error:


Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in \\nawinfs02\home\users\web\b885\rh.mysite\orderform\process_transaction.php on line 39

ok and it's on line 39:

Line 39: $message .= "<tr>";
Line 40: $message .= "<td><?php echo $_GET["amount"]; ?></td>";



Below is the process_transaction.php file:


<?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@valleyanimal.org';  
            	$subject = 'New Donation';
            	$header = 'From: no-reply@valleyanimal.org';
                $message = '<html><body>';
                $message .= "<head>";
                $message .= "<title>Donation Information</title>";
                $message .= "</head>";
                $message .= "<body>";
                $message .= "<p>Donation Information</p>";
                $message .= "<table>";
                $message .= "<tr>";
                $message .= "<th><p>Donation Amount:<p></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)));

?>


Is This A Good Question/Topic? 0
  • +

Replies To: PHP Error

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3105
  • View blog
  • Posts: 10,905
  • Joined: 08-August 08

Re: PHP Error

Posted 08 February 2010 - 06:08 PM

Extremely repetitive code there! It makes my eyes glaze over, and no doubt yours do too. Work on reducing the number of lines of code you've got or you're going to have more problems when the code gets even larger!
Look at your code:

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


You're already in php, so breaking in doesn't make much sense!
Was This Post Helpful? 1
  • +
  • -

#3 drewpark88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 08-February 10

Re: PHP Error

Posted 08 February 2010 - 07:50 PM

Yeah, I'm a noob. Trying hard to learn and going to go over the PHP manual like 50 times. Anyways thanks for the help I appreciate you taking the time to look over my code. I should probably code it more like this im guessing:

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


View PostCTphpnwb, on 08 February 2010 - 05:08 PM, said:

Extremely repetitive code there! It makes my eyes glaze over, and no doubt yours do too. Work on reducing the number of lines of code you've got or you're going to have more problems when the code gets even larger!
Look at your code:

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


You're already in php, so breaking in doesn't make much sense!

Was This Post Helpful? 0
  • +
  • -

#4 TabulaRasa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 06-February 10

Re: PHP Error

Posted 08 February 2010 - 10:17 PM

View Postdrewpark88, on 08 February 2010 - 04:07 PM, said:

I am getting this error:

Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in \\nawinfs02\home\users\web\b885\rh.mysite\orderform\process_transaction.php on line 39

ok and it's on line 39:

Line 39: $message .= "<tr>";
Line 40: $message .= "<td><?php echo $_GET["amount"]; ?></td>";

At first glance and going by the error message I'd suggest enclosing "amount" in single quotes - ie 'amount'.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1