Jump to content

Parse error: parse error, unexpected $.. ARGGGGG ** SOLVED **


jwk811

Recommended Posts

i took this out to see if this was the problem and it was.. can you tell me whats wrong with this?
[code]<?php

if (isset($_POST['optPayment'])) {
$optPayment = $_POST['optPayment'];


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 = '';
}

} else {
$paypal_checked = 'checked="checked"';
$cod_checked = '';
?>[/code]
Link to comment
Share on other sites

[quote author=jwk811 link=topic=113794.msg462728#msg462728 date=1162606361]
this is weird.. im getting this error: Parse error: parse error, unexpected $
on the very last line where it says </form>.. what could cause this
[/quote]

Symptomatic of an unclosed loop.  If you indent every loop it makes it much easier to spot when you fail to close them.,
Link to comment
Share on other sites

[code]
<?php
if (isset($_POST['optPayment'])) {
    $optPayment = $_POST['optPayment'];
    if ($optPayment == 'paypal') {
$paypal_checked = 'checked="checked"';
    } else if ($optPayment == 'cod') {
$paypal_checked = '' ;
    } else {
$paypal_checked = 'checked="checked"';
    }
    if ($optPayment == 'cod') {
$cod_checked = 'checked="checked"';
    } else if ($optPayment == 'paypal') {
$cod_checked = '';
    }  //<--I think I just found it.
} else {
$cod_checked = '';
}
[/code]
Link to comment
Share on other sites

It should read like this


[code]
<?php

if (isset($_POST['optPayment'])) {
    $optPayment = $_POST['optPayment'];

    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 = '';
    }

} else {
$paypal_checked = 'checked="checked"';
$cod_checked = '';
} //YOU WERE MISSING THIS BRACKET...
?>

[/code]

you are missing the last bracket. Hope this helps
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.