Jump to content


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


URL variables

Recommended Posts

Im trying to update my site using php, so learning as i go with simple functions and scripts, i have a question regarding a URL variable get command (think thats what its called)

The majority of the code works fine with no problems, issues i am having are when i try and get from another directory, or when calling on a php script like phpbb2.

right now i have my page seperated into two frames, one which i use for the link menu and banner image and the "body" frame which i direct all my links to.

I would like to keep this setup, but want to get rid of the frames, most of the url variable get functions work correctly. its just when i try and get something that resides in another directory, or as i said above something like phpbb2.

i tried a work around for the forum issue with phpbb2 making a forum.php file and doing an include in that file and using the url variable to call that


and it will pull the page up, and place it in the body, but the style is gone, aas well as any images ect...

I dont know if ive been clear or just rambled, let me know, i would like to see this work, or some idea's on how to handle this situation.


Share this post

Link to post
Share on other sites
A little rambly :)  I'll try to clarify some things

Can you give more detail about what "get from another directory" means?  Are you talking about forms, eg <form method=get>, or about links, eg <a href="page.php?var=value">?  Or something else?

Also, are you using cookies or sessions (or neither)?

Share this post

Link to post
Share on other sites
This is the coding i would like to use and is what i mean by the get function

[code]$p = $_GET["page"];[/code]

im not using cookies or sessions

and as i said, it will load the php pages that reside in the same dir. as the code below, well i beleive it will load any directory as long as i type it that way


like above

but its not loading the images ect along with the content, as i can see the image paths are getting lost or rather being changed to the url of the path of this script

so instead of myhost.com/forum/pictures

its making it myhost.com/pictures

and then none of the links work in the forum, because i am assuming, they are no longer relative to the current path

require "fcbanner.php";

require "menu.php";


$p = $_GET["page"];
if (strpos($p,"..")) {
    die("Bad page request");
if (!$p) $p = "main2";
if (!file_exists($content_file)) {
    header("Location: {$_SERVER["PHP_SELF"]}");
// Syntax: $variable = (condition) ? value_if_true : value_if_false;
$title = ($p) ? "$p - Fated Chaos" : "Main page - Fated Chaos";



Share this post

Link to post
Share on other sites


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.