I'm trying to make a simple link system on my website. My friend had coded this previously and it worked. I basically tried to recode it myself with a little help from him over a chat session and for some reason it's just not working. If someone could help point out what I'm doing wrong, I would appreciate it very much.
$page = 'home.php';
$link = 'home'; <====== was $_GET['home.php']; but I changed it.
if ($link == 'home'){
$page = 'home.php';
}
if ($link == 'links'){
$page = 'links.php';
}
if ($link == 'about'){
$page = 'about.php';
}
include $page;
It's not giving me any errors... It's just not pulling up the content from the other php files. Maybe I should change the page= to use the $_GET variable?
A litte help please...
Moderator: General Moderators
Re: A litte help please...
try putting double quote around the variable in front of the include like this:
Code: Select all
include "$page";Re: A litte help please...
Actually I forgot to mention that that's probably the only thing that works. It's including the home page, the links just aren't changing to the content that I have in the other php files.
<a href="test.php?link=home">HOME</a><br />
<a href="test.php?link=links">LINKS</a><br />
<a href="test.php?link=about">ABOUT</a>
Those are the links I'm using. The php files are located in the same directory as test.php.
<a href="test.php?link=home">HOME</a><br />
<a href="test.php?link=links">LINKS</a><br />
<a href="test.php?link=about">ABOUT</a>
Those are the links I'm using. The php files are located in the same directory as test.php.
Re: A litte help please...
what you are suppose to do then is
Put that code at the very line you changed.
Code: Select all
$link = $_GET['link'];B17BR34K wrote: $link = 'home'; <====== was $_GET['home.php']; but I changed it.
Re: A litte help please...
temidayo
Thanks, that fixed the problem. I guess my friend didn't remember how he had coded it the first time.
Thanks, that fixed the problem. I guess my friend didn't remember how he had coded it the first time.
Re: A litte help please...
You are welcome!