Forum Moderators: coopster

Message Too Old, No Replies

Parse Error this, Parse Error that...

Parse Error this, Parse Error that...

         

tek420angel

6:00 pm on Dec 20, 2004 (gmt 0)

10+ Year Member



Hey everyone... New to the world of PHP so please bear with me. Any help you might direct my way will be hugely appreciated. I'm pulling my hair out now at this point trying to figure this problem out.

K, I've got a make a payment page. There are 3 options. Credit, Check and something we call EasyPay which is just like putting payments on a continual basis. I'm using a switch statement (failing miserably, too) when trying to send this data over to our server. K, so here's the code:

echo $_POST['PaymentType'];
switch ($_POST['PaymentType'])
{ case 'PaymentType' == "Credit"
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formInsertRecord")) {
$insertSQL = sprintf("INSERT INTO payments (AccountNumber, FirstName, LastName, Phone, Email, PaymentAmount, Attention, CCType, CCNumber, CCExpMonth, CCExpYear, CCFullName, CHNumber, CHDate, CHBankName, CHRoutingNumber, CHAccountNumber, Address1, Address2, City, `State`, Zip, RecurrenceDate, Comments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['txtAccountNumber'], "text"),
GetSQLValueString($_POST['txtFirstName'], "text"),
GetSQLValueString($_POST['txtLastName'], "text"),
GetSQLValueString($_POST['txtPhone'], "text"),
GetSQLValueString($_POST['txtEmail'], "text"),
GetSQLValueString($_POST['txtAmount'], "double"),
GetSQLValueString($_POST['txtPayAttn'], "text"),
GetSQLValueString($_POST['selectCCType'], "text"),
GetSQLValueString($_POST['txtCCNumber'], "text"),
GetSQLValueString($_POST['selectCCExpMonth'], "text"),
GetSQLValueString($_POST['selectCCExpYear'], "text"),
GetSQLValueString($_POST['txtCCName'], "text"),
GetSQLValueString($_POST['txtCHNumber'], "bigint"),
GetSQLValueString($_POST['txtCHDate'], "date"),
GetSQLValueString($_POST['txtCHBank'], "text"),
GetSQLValueString($_POST['txtCHRouting'], "text"),
GetSQLValueString($_POST['txtCHAccountNum'], "bigint"),
GetSQLValueString($_POST['txtAddress1'], "text"),
GetSQLValueString($_POST['txtAddress2'], "text"),
GetSQLValueString($_POST['txtCity'], "text"),
GetSQLValueString($_POST['selectSt'], "text"),
GetSQLValueString($_POST['txtZip'], "int"),
GetSQLValueString($_POST['txtRecurringDate'], "date"),
GetSQLValueString($_POST['txtComments'], "text"));

mysql_select_db($database_pbsstuff, $pbsstuff);
$Result1 = mysql_query($insertSQL, $pbsstuff) or die(mysql_error());

//This will take you to the tt
header("Location: [website.com");...]
break;

case 'PaymentType' == "Check"
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formInsertRecord")) {
$insertSQL = sprintf("INSERT INTO payments (AccountNumber, FirstName, LastName, Phone, Email, PaymentAmount, Attention, CCType, CCNumber, CCExpMonth, CCExpYear, CCFullName, CHNumber, CHDate, CHBankName, CHRoutingNumber, CHAccountNumber, Address1, Address2, City, `State`, Zip, RecurrenceDate, Comments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['txtAccountNumber'], "text"),
GetSQLValueString($_POST['txtFirstName'], "text"),
GetSQLValueString($_POST['txtLastName'], "text"),
GetSQLValueString($_POST['txtPhone'], "text"),
GetSQLValueString($_POST['txtEmail'], "text"),
GetSQLValueString($_POST['txtAmount'], "double"),
GetSQLValueString($_POST['txtPayAttn'], "text"),
GetSQLValueString($_POST['selectCCType'], "text"),
GetSQLValueString($_POST['txtCCNumber'], "text"),
GetSQLValueString($_POST['selectCCExpMonth'], "text"),
GetSQLValueString($_POST['selectCCExpYear'], "text"),
GetSQLValueString($_POST['txtCCName'], "text"),
GetSQLValueString($_POST['txtCHNumber'], "bigint"),
GetSQLValueString($_POST['txtCHDate'], "date"),
GetSQLValueString($_POST['txtCHBank'], "text"),
GetSQLValueString($_POST['txtCHRouting'], "text"),
GetSQLValueString($_POST['txtCHAccountNum'], "bigint"),
GetSQLValueString($_POST['txtAddress1'], "text"),
GetSQLValueString($_POST['txtAddress2'], "text"),
GetSQLValueString($_POST['txtCity'], "text"),
GetSQLValueString($_POST['selectSt'], "text"),
GetSQLValueString($_POST['txtZip'], "int"),
GetSQLValueString($_POST['txtRecurringDate'], "date"),
GetSQLValueString($_POST['txtComments'], "text"));

mysql_select_db($database_pbsstuff, $pbsstuff);
$Result1 = mysql_query($insertSQL, $pbsstuff) or die(mysql_error());

//This will take you to the tt
header("Location: [website.com");...]
break;

case 'PaymentType' == "EasyPay"

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formInsertRecord")) {
$insertSQL = sprintf("INSERT INTO payments (AccountNumber, FirstName, LastName, Phone, Email, PaymentAmount, Attention, CCType, CCNumber, CCExpMonth, CCExpYear, CCFullName, CHNumber, CHDate, CHBankName, CHRoutingNumber, CHAccountNumber, Address1, Address2, City, `State`, Zip, RecurrenceDate, Comments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['txtAccountNumber'], "text"),
GetSQLValueString($_POST['txtFirstName'], "text"),
GetSQLValueString($_POST['txtLastName'], "text"),
GetSQLValueString($_POST['txtPhone'], "text"),
GetSQLValueString($_POST['txtEmail'], "text"),
GetSQLValueString($_POST['txtAmount'], "double"),
GetSQLValueString($_POST['txtPayAttn'], "text"),
GetSQLValueString($_POST['CONTselectCCType'], "text"),
GetSQLValueString($_POST['CONTtxtCCNumber'], "text"),
GetSQLValueString($_POST['CONTselectCCExpMonth'], "text"),
GetSQLValueString($_POST['CONTselectCCExpYear'], "text"),
GetSQLValueString($_POST['CONTtxtCCName'], "text"),
GetSQLValueString($_POST['CONTtxtCHNumber'], "bigint"),
GetSQLValueString($_POST['CONTtxtCHDate'], "date"),
GetSQLValueString($_POST['CONTtxtCHBank'], "text"),
GetSQLValueString($_POST['CONTtxtCHRouting'], "text"),
GetSQLValueString($_POST['CONTtxtCHAccountNum'], "bigint"),
GetSQLValueString($_POST['CONTtxtAddress1'], "text"),
GetSQLValueString($_POST['CONTtxtAddress2'], "text"),
GetSQLValueString($_POST['CONTtxtCity'], "text"),
GetSQLValueString($_POST['CONTselectSt'], "text"),
GetSQLValueString($_POST['CONTtxtZip'], "int"),
GetSQLValueString($_POST['CONTtxtRecurringDate'], "date"),
GetSQLValueString($_POST['CONTtxtComments'], "text"));

mysql_select_db($database_pbsstuff, $pbsstuff);
$Result1 = mysql_query($insertSQL, $pbsstuff) or die(mysql_error());

//This will take you to the tt
header("Location: [website.com");...]
break;
}

?>
I've gotten all sorts of parse errors while trying to figure this out...

Parse error: parse error, unexpected T_VARIABLE in (etc etc) on line 57

is the latest.. I keep trying to change things around according to info I can find in forums and stuff but people don't have the exact problem as I do and I realized I'm just wasting time with this. It's really rather frustrating. Again, any help is MUCH appreciated...

Thanks..

tek420angel

6:39 pm on Dec 20, 2004 (gmt 0)

10+ Year Member



Okay, I've been told by another source to enclose by SQL statements with }'s. I did so, and so I get:

Parse error: parse error, unexpected T_VARIABLE in /var/www/html/jamie/pbs/MakePaymentNEW.php on line 57

mincklerstraat

4:54 pm on Dec 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hey tek, welcome to Webmasterworld [webmasterworld.com].

First thing you'll want to do is get yourself an editor that will show you line numbers - jedit is great, multi-platform, and will also show you matching brackets.

Then, you can see which line that is, and when you post code, just post the stuff a line or two above and below the error, so we're more likely to be able to help out. Also see guidelines on posting code [webmasterworld.com].

Apart from this, I notice that your switch syntax looks funny - I'd mosey on over to the php manual at [php.net...] and check that out - switch goes like:

switch($value){
case 'somevalue':
dothis();
dothat();
break;

case 'someothervalue':
dosomeotherthing();
break;
}

I'm not seeing your colons.

here's the link to the syntax for switch: [be2.php.net...]