PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Pommy
Forum Newbie
Posts: 1 Joined: Mon Dec 30, 2002 6:21 pm
Post
by Pommy » Mon Dec 30, 2002 6:21 pm
I'm brand new to php. I'm trying have PHP navigation on my website but its not working here is my code:
Code: Select all
<?php
if ($page == "news") {
include "news.html";
?>
When I do this inside the address bar:
It doesn't do anything. How do I make it when I type "page" it changes the variable.
oldtimer
Forum Contributor
Posts: 204 Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State
Post
by oldtimer » Mon Dec 30, 2002 6:51 pm
Try
Code: Select all
<?php
if ($page==news) {
include "news.html";
}
?>
I myself dont usually have the "" around the one value.
I have a link on apage that shows up only when I log into it and it looks like
Code: Select all
<?php
if ($variable==me) {
// then it shows a link
}
?>
laserlight
Forum Commoner
Posts: 28 Joined: Wed Jan 01, 2003 6:41 am
Post
by laserlight » Wed Jan 01, 2003 7:16 am
hmm... both should work, assuming the missing closing brace wasnt a mistake.
maybe auto-globals not on?
so you should use $_GET['page'] or $HTTP_GET_VARS['page'] instead of $page