TeddyKiller Posted April 25, 2010 Share Posted April 25, 2010 If I have a variable.. eg: $variable = 'on' I do an if statement to see if $varible == 'on' If true, I'd like to display a page within that page. So.. basically.. I don't want the actual page to load past this point, just want to load a page within the page being viewed instead? It'll be like a redirection to an error page.. only it doesn't redirect, it just displays that page instead? Do you get me? How can this be done. Quote Link to comment https://forums.phpfreaks.com/topic/199631-if-true-load-this-page/ Share on other sites More sharing options...
oni-kun Posted April 25, 2010 Share Posted April 25, 2010 //Random.php?page=abc <?php if ($_GET['page'] == 'abcde') { $variable = TRUE; } //... if(!$variable) { print "Uh oh, Page is wrong!"; exit(); } //.. ?> Although by your wording, I have absolutely no clue what you're talking about. Are you wanting to display a page if it exists, and if it doesn't display an error dynamically or something? Quote Link to comment https://forums.phpfreaks.com/topic/199631-if-true-load-this-page/#findComment-1047804 Share on other sites More sharing options...
mikesta707 Posted April 25, 2010 Share Posted April 25, 2010 sounds like your looking for include() if ($var == 'on'){ //whatever } else { include("error.php"); } Quote Link to comment https://forums.phpfreaks.com/topic/199631-if-true-load-this-page/#findComment-1047809 Share on other sites More sharing options...
TeddyKiller Posted April 25, 2010 Author Share Posted April 25, 2010 sounds like your looking for include() if ($var == 'on'){ //whatever } else { include("error.php"); } D'oh. Simple solution ha. I'd put an exit; after it too probably? To make it stop loading the current page. It's not actually like an error page, it's more or less like.. under construction. I can't think of a better way to put it really. As for oni-kun, I wanted to display a whole error page, rather than printing 1 line. So.. it'll be a big print to display a whole page Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/199631-if-true-load-this-page/#findComment-1047913 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.