clicking on link, according html-page opens in cell

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
magdi
Forum Newbie
Posts: 9
Joined: Sat Mar 13, 2004 4:36 am

clicking on link, according html-page opens in cell

Post by magdi »

First of all let's state that I'm a beginner (sorry). I've searched for an answer in the forum but haven't found it. Should I have missed it (maybe I used the wrong keywords) feel free to tell me.

I have a php page which consists of a table (no frames!) with 3 cells.
At the left a cell that includes an html-page (main menu).
At the top a cell that includes another html-page (submenu).

I want the users that click a link in the submenu to see the according page appear in my middle-cel.

Thought that the following might be the way to do it, if a user clicks a link in the submenu:
1) a variable is being stored (e.g. submenu item: 'hobbies' =1, 'pets' =2,...)
2) the php script that's in the middle-cel is being triggered to catch the number that's being stored and calling the right html-page.

So what I would need is the code that needs to be on the link in my submenu and the code for the middle-cel.
Or am I making it just to complicated?

Actually I thought it would be possible because oscommerce seems to work in that way. A main page of which the cell content changes according to what you click.

As I'm a beginner a step-by-step answer would be veeeery nice. I'm willing to work very hard to understand your answer and to get it right.



Thank you in advance.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Would'nt an <iframe> do the trick?
magdi
Forum Newbie
Posts: 9
Joined: Sat Mar 13, 2004 4:36 am

The Answer

Post by magdi »

I got the answer and it works very well, here's the solution so it might help somebody with the same question in the future:

1) The code you should put on the links:

<A HREF="index.php?item=hobbies&">hobbies</A>

2) The code you should insert in the cell you want the page to appear:

<?
$item=$_GET["item"];
switch ($item) {
case "over":
include("hobbies.inc");
break;
case "visie":
include("brothers.inc");
break;
case "contact":
include("sisters.inc");
break;
default:
include("index.inc");

}
?>

---
Thank you Koen at phpfreakz.nl for showing me the way and Folkert designhulp.nl for the answer you posted a long time ago.

If anybody has other answers...feel free to add them.
Post Reply