carr Posted April 12, 2007 Share Posted April 12, 2007 I'm sorry if this is a simple mistake, I'm rather tired. When designing a rather basic page, I'm simply getting nothing displayed. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>KOAT</title> </head> <body> <div class="header"> <img src="banner.gif" alt="logo" /> </div> <div id="main"> <?php { if (isset("".$_GET['page'].".php")) if ("".$_GET['page'] == 'index') { include('intro.php'); } else { include("".$_GET['page'] . ".php"); } else { include('intro.php'); } } ?> ?> </div> <div id="footer"> <img src="footer.jpg" alt="logo" /> </div> </body> </html> www.kreweofarcaneterrors.com/test --Thanks Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/ Share on other sites More sharing options...
Caesar Posted April 12, 2007 Share Posted April 12, 2007 If you're getting a blank page, it most likely means PHP is outputting an error, and display_errors is turned off on your server. Before anything else, remove the extra closing php tag here: else { include('intro.php'); } } ?> ?> Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227302 Share on other sites More sharing options...
MadTechie Posted April 12, 2007 Share Posted April 12, 2007 Huh <?php if (isset("".$_GET['page'].".php")) ?> Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227303 Share on other sites More sharing options...
carr Posted April 12, 2007 Author Share Posted April 12, 2007 Alright, PHP tag removed, thank you. MadTechie, I'm not sure if I understand your post. Is my programming that absurd? Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227304 Share on other sites More sharing options...
Caesar Posted April 12, 2007 Share Posted April 12, 2007 Yeah...that is definitely not right. You have several errors in your code. And your if/else statements are not well formed. Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227305 Share on other sites More sharing options...
carr Posted April 12, 2007 Author Share Posted April 12, 2007 Okay, thank you. I'll start over. Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227306 Share on other sites More sharing options...
MadTechie Posted April 12, 2007 Share Posted April 12, 2007 <?php if (isset("".$_GET['page'].".php")) ?> isset — Determine whether a variable is set "".$_GET['page'].".php" isn't a variable it should be something like <?php if (isset($_GET['page'])) ?> Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227307 Share on other sites More sharing options...
Caesar Posted April 12, 2007 Share Posted April 12, 2007 Carr, here's a small example of how you can do this: Asuming your urls will looke like this -> index.php?page=login... <?php if (isset($GET['page'])) { if($_GET['page'] == 'login') { include'login.php'; } elseif($_GET['page'] == 'news') { include'news.php'; } else { include'members.php'; } } else { include'main.php'; } ?> Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227310 Share on other sites More sharing options...
MadTechie Posted April 12, 2007 Share Posted April 12, 2007 or using Caesar nice example you could use this code Caesar check the isset (GET?) <?php if (isset($_GET['page'])) { switch($_GET['page']) { case 'login': include'login.php'; break; case 'news': include'news.php'; break; case 'members': include'members.php'; break; default: include'main.php'; break; } } ?> Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227313 Share on other sites More sharing options...
Caesar Posted April 12, 2007 Share Posted April 12, 2007 Yep. Using a switch will also do the trick :-) Link to comment https://forums.phpfreaks.com/topic/46663-solved-error-in-display/#findComment-227316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.