For illustration purposes i have these 3 codes in a php page (but they not necessarily an "echo" call and can be something else). <?php echo "Power"; ?> <?php echo "Wealth"; ?> <?php echo "Money"; ?> What I want is to display only one of them through a link like this; Power | Wealth | Money. When someone click "Power" link, the page refreshes and displays Power. When "Wealth" is clicked the page refreshes and displays Wealth and so on. Any help will be appreciated. Have a nice day.
so the link would be something like index.php?get=power then the php page would get the right info, display the "menu" again. Is that what you mean?
Along with what sarahk said, you'd also need to code the $_GET[] PHP function. Your page would look something like this: <html> <head> <title>Index.php</title> </head> <body> <?php if($_GET['page']=="power"){ echo "Power page."; } else if($_GET['page']=="wealth"){ echo "Wealth page."; } else if($_GET['page']=="money"){ echo "Money page."; } else { echo "Please choose a page.<br />"; echo "<a href=\"index.php?page=power\">Power</a>. <a href=\"index.php?page=wealth\">Wealth</a>. <a href=\"index.php?page=money\">Money</a>."; } ?> </body> </html> PHP:
Thank you both of you. Anyway, I have tested the code but when I click on the link I am redirected to the homepage. I used the codes on a different page other than the home page.
The way I coded my file was assuming that this would be a one page kind of site. Since you have multiple pages, you'd have to change the index.php?page=whatever in the code I wrote. If you still need help feel free to PM me.