Jump to content

help me place these brackets please......parse error, unexpected '}'


jwk811

Recommended Posts

ughhh im always having trouble with these brackets and getting this error: Parse error: parse error, unexpected '}' ... can you tell me whats wrong with this one? and the effected part is:
[code]} else if ($optPayment == 'cod') { [/code] theres probably more but im not sure.. thats the first error anyways... any help would be great.. thank you!

[code]<?php

if ($optPayment == 'paypal') {
$paypal_checked = 'checked="checked"'
} else if ($optPayment == 'cod') {
$paypal_checked = ''
} else {
$paypal_checked = checked="checked"'
}
?>

<?php

if ($optPayment == 'cod') {
$cod_checked = 'checked="checked"'
} else if ($optPayment == 'paypal') {
$cod_checked = ''
} else {
$cod_checked = ''
}

?>[/code]
It's because you don't have any semi-colons to end the statements.

[code]
<?php

if ($optPayment == 'paypal') {
$paypal_checked = 'checked="checked"';
} else if ($optPayment == 'cod') {
$paypal_checked = '' ;
} else {
$paypal_checked = 'checked="checked"';//<--you were also missing a quote here (after the first equal sign)
}
?>

<?php
if ($optPayment == 'cod') {
$cod_checked = 'checked="checked"';
} else if ($optPayment == 'paypal') {
$cod_checked = '';
} else {
$cod_checked = '';
}
?>
[/code]

The semi-colon tells PHP that "this statement is ending".  When you didn't show it, you got the error.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.