T_VARIABLE problem
Moderator: General Moderators
T_VARIABLE problem
hi,
please could you have a look at this code and tell me how i could fix it? its something to do with the session variable being inside the else brackets:
if ($_SESSION["order1"] == "") {} else {echo "<div class=\"ps\">$_SESSION["order1"]</div>};
it would greatly be appreciated,
dave
please could you have a look at this code and tell me how i could fix it? its something to do with the session variable being inside the else brackets:
if ($_SESSION["order1"] == "") {} else {echo "<div class=\"ps\">$_SESSION["order1"]</div>};
it would greatly be appreciated,
dave
Code: Select all
{echo '<div class="ps">'.$_SESSION["order1"].'</div>'};
//OR
{echo "<div class="ps">".$_SESSION["order1"]."</div>"}; //<==LAST QUOTE!or
Code: Select all
(!empty($_SESSION["order1"])) ? echo '<div class="ps">'.$_SESSION["order1"].'</div>' : '';-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
or:
Code: Select all
if ($_SESSION['order1'] == "") {} else {echo "<div class="ps">{$_SESSION['order1']}</div>"};-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
not reallyIllusionist wrote:or:Code: Select all
if ($_SESSION['order1'] == "") {} else {echo "<div class="ps">{$_SESSION['order1']}</div>"};
patricks works the best, because it only checks one thing, and then does something if it's right. you have a if statement there for no reason, just a waste of space
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm