aebstract Posted November 18, 2007 Share Posted November 18, 2007 Eh, I don't see a problem with it and I have isolated it down to this chunk of code, so maybe someone can see what is causing it. I know there are probably shorter ways to do this same code, but for now just help getting the error out if you don't mind. Thanks! <?php if ($page == home) { echo '<div id="nav1"><a href="/print/"><img src="/printx.png" border="0" /></a></div> <div id="nav2"><a href="/identity/"><img src="/identityxx.png" border="0" /></a></div> <div id="nav3"><a href="/web/"><img src="/webx.png" border="0" /></a></div> <div id="nav4"><a href="/home/"><img src="/home.png" border="0" /></a></div>'; } elseif ($page == web) { echo '<div id="nav1"><a href="/print/"><img src="/printx.png" border="0" /></a></div> <div id="nav2"><a href="/identity/"><img src="/identityx.png" border="0" /></a></div> <div id="nav3"><a href="/web/"><img src="/web.png" border="0" /></a></div> <div id="nav4"><a href="/home/"><img src="/homex.png" border="0" /></a></div>'; } elseif ($page == identity) { echo '<div id="nav1"><a href="/print/"><img src="/printxx.png" border="0" /></a></div> <div id="nav2"><a href="/identity/"><img src="/identity.png" border="0" /></a></div> <div id="nav3"><a href="/web/"><img src="/webxx.png" border="0" /></a></div> <div id="nav4"><a href="/home/"><img src="/homexx.png" border="0" /></a></div>'; } elseif ($page == print) { echo '<div id="nav1"><a href="/print/"><img src="/print.png" border="0" /></a></div> <div id="nav2"><a href="/identity/"><img src="/identityxxx.png" border="0" /></a></div> <div id="nav3"><a href="/web/"><img src="/webxxx.png" border="0" /></a></div> <div id="nav4"><a href="/home/"><img src="/homexx.png" border="0" /></a></div>'; } else { echo '<div id="nav1"><a href="/print/"><img src="/printx.png" border="0" /></a></div> <div id="nav2"><a href="/identity/"><img src="/identityxx.png" border="0" /></a></div> <div id="nav3"><a href="/web/"><img src="/webx.png" border="0" /></a></div> <div id="nav4"><a href="/home/"><img src="/home.png" border="0" /></a></div>'; } ?> Link to comment https://forums.phpfreaks.com/topic/77845-solved-simple-php-code-displaying-white-page/ Share on other sites More sharing options...
GingerRobot Posted November 18, 2007 Share Posted November 18, 2007 Two things: 1.)$page is undefined - if it comes from the URL, take it out of the $_GET array, if its posted, take it out of the $_POST array 2.)You need to quote your strings in your if statement, like if($page == 'home'){ The reason for the blank screen is that your script produces a parse error (for the reasons given above) and you have php set up not to display errors - therefore you don't even see the error. Link to comment https://forums.phpfreaks.com/topic/77845-solved-simple-php-code-displaying-white-page/#findComment-394012 Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 Cool, I had forgot that was necessary in that part, the $page variable is set earlier in the script. That's why I mentioned isolating the problem down to this. Thank You! Link to comment https://forums.phpfreaks.com/topic/77845-solved-simple-php-code-displaying-white-page/#findComment-394016 Share on other sites More sharing options...
GingerRobot Posted November 18, 2007 Share Posted November 18, 2007 That's why I mentioned isolating the problem down to this. Thank You! Ah ok - i misread. Glad to help. Link to comment https://forums.phpfreaks.com/topic/77845-solved-simple-php-code-displaying-white-page/#findComment-394025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.