View Full Version : error below appears in the line 1502, where may be the problem ?
leonidassavvides
03-03-2009, 07:35 PM
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:
<td> <?php echo date("H:i l F dS, Y", $dated); ?> to <?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
thetestingsite
03-03-2009, 07:48 PM
The error lies with this portion of the above code:
<?php (isset($_SESSION['a2'])) ? echo "$Locationd ($a2)" : echo "$Locationd"; ?>
Change to the following and the error should go away:
<?php echo (isset($_SESSION['a2'])) ? "$Locationd ($a2)" : "$Locationd"; ?>
Hope this helps.
leonidassavvides
03-03-2009, 09:29 PM
error disappears but nothing printed on screen , well ?
Schmoopy
03-03-2009, 09:35 PM
The code the Hypnotoad (testingsite) has written is valid, make sure that your variables aren't empty.
Example:
$Locationd = "";
Will echo nothing of course.
leonidassavvides
03-03-2009, 09:46 PM
<?=$Locationd; echo (a2!="") ? " ($a2)" : ""; ?>
this is also valid ?
thetestingsite
03-04-2009, 04:32 AM
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.
<?=$Locationd;?> <?php echo ($a2!="") ? " ($a2)" : ""; ?>
Hope this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.