Jump to content

If true, load this page.


TeddyKiller

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/199631-if-true-load-this-page/
Share on other sites

//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?

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 :P

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.