I have the following code on my website:
<?php
$loggedout = $_GET["loggedout"];
if ($loggedout=="true") {
echo '<body class="slider-header" onload="Modalbox.show(\'/data/loggedout\',{width: 576, title: \'Logged Out\'}); return false;">'; else {
if (isset($_COOKIE["hide"]))
echo '<body class="slider-header">';
else
echo '<body class="slider-header" onload="Modalbox.show(\'/data/surveyinvite\',{width: 576, title: \'Website Survey\'}); return false;">';
}; ?>
What this should do is determine if $loggedout
equals true and, if so, display /data/loggedout
. If $loggedout
is not true (or not present), it should then go on to determine if the cookie hide
exists. If the cookie does exist, there should be no onload
and if the cookie does not exist, it should display /data/surveyinvite
.
However, I get the following error when going to my page:
Parse error: syntax error, unexpected T_ELSE in /home/briefs/public_html/index.php on line 16
Line 16 is
echo '<body class="slider-header" onload="Modalbox.show(\'/data/loggedout\',{width: 576, title: \'Logged Out\'}); return false;">'; else {
I have determined that issue is somewhere in the following (if I get rid of it, $loggedout
works as expected):
if (isset($_COOKIE["hide"]))
echo '<body class="slider-header">';
else
echo '<body class="slider-header" onload="Modalbox.show(\'/data/surveyinvite\',{width: 576, title: \'Website Survey\'}); return false;">';
};
Where is the issue in this code?