Page 1 of 1

PHP Navigation

Posted: Mon Dec 30, 2002 6:21 pm
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.

Posted: Mon Dec 30, 2002 6:51 pm
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
}


?>

Posted: Wed Jan 01, 2003 7:16 am
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