Results 1 to 6 of 6

Thread: error below appears in the line 1502, where may be the problem ?

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default error below appears in the line 1502, where may be the problem ?

    error below appears in the line 1502, where may be the problem ? appear when add $a2 & $_SESSION['a2'], where are the same values, and get values from a form(dynamically appear a2 textbox when a select box is in selectedIndex=3)...

    line 1502:
    Code:
        <td>&nbsp;<?php echo date("H:i l F dS, Y", $dated); ?>&nbsp; to &nbsp;<?php (isset($_SESSION['a2'])) ? echo "$Locationd ($a2)" : echo "$Locationd";   ?></td>

    Parse error: syntax error, unexpected T_ECHO in /home/content/p/o/l/polisch123/html/quote/quote1a-acc-comments.php on line 1502

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    The error lies with this portion of the above code:

    Code:
    <?php (isset($_SESSION['a2'])) ? echo "$Locationd ($a2)" : echo "$Locationd";   ?>
    Change to the following and the error should go away:

    Code:
    <?php echo (isset($_SESSION['a2'])) ? "$Locationd ($a2)" : "$Locationd";   ?>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    error disappears but nothing printed on screen , well ?

  4. #4
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    The code the Hypnotoad (testingsite) has written is valid, make sure that your variables aren't empty.

    Example:

    $Locationd = "";

    Will echo nothing of course.

  5. #5
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    <?=$Locationd; echo (a2!="") ? " ($a2)" : ""; ?>

    this is also valid ?

  6. #6
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    The code you posted could be valid with some changes, but not sure if it would work in your situation. Basically, the above is just echoing the variable $Locationd and then trying to echo $a2 if that variable is not empty. I have modified what you posted above in the following snippet.

    Code:
    <?=$Locationd;?> <?php echo ($a2!="") ? " ($a2)" : ""; ?>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •