Forum Moderators: coopster
///////test.php//////////
<html>
<head><title></title></head>
<body>
<a href="<?php echo $PHP_SELF;?>?home=1">Home</a>
<a href="<?php echo $PHP_SELF;?>?about=1">About/Contact Us</a>
<a href="<?php echo $PHP_SELF;?>?products=1">Products</a>
<a href="<?php echo $PHP_SELF;?>?services=1">Services</a>
<a href="<?php echo $PHP_SELF;?>?repair=1">Repair</a>
<a href="<?php echo $PHP_SELF;?>?network=1">Network</a>
<br><br><br>
<?php
if ($_GET['home'] = '1') {
?>
Only This text SHOULD show if you clicked on Home.
<?php
}
if ($_Get['about'] = '1') {
?>
Only This text SHOULD show if you clicked on About Us.
<?php
}
if ($_Get['products'] = '1') {
?>
Only This text SHOULD show if you clicked on Products.
<?php
}
if ($_Get['services'] = '1') {
?>
Only This text SHOULD show if you clicked on Services.
<?php
}
if ($_Get['repair'] = '1') {
?>
Only This text SHOULD show if you clicked on Repair.
<?php
}
if ($_Get['network'] = '1') {
?>
Only This text SHOULD show if you clicked on Network.
<?php
}
?>
//End of Document//
</body>
</html>
Hugh's post should solve your problem.
However, $PHP_SELF is deprecated and has been replaced with $_SERVER['PHP_SELF']. I would probably have opted for a slightly different style of coding - something more like
?page=home
?page=repair
...
and then have performed a switch/elseif on the variable $home, having already checked that the var exists.
$page=(isset($_GET['page']))?$_GET['page']:'gah';
hth
Andy