PHP Navigation

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

Post Reply
Pommy
Forum Newbie
Posts: 1
Joined: Mon Dec 30, 2002 6:21 pm

PHP Navigation

Post by Pommy »

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") &#123;
	include "news.html";
?>
When I do this inside the address bar:

Code: Select all

index.php?page=news
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 »

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 »

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
Post Reply