Log in

View Full Version : place different containers in an html page using php



wildheart25c
03-05-2012, 09:18 PM
Good day,
http://img10.imageshack.us/img10/7831/layoutjt.jpg

I created a webpage (lets call it index.html) that looks like this layout using html and css. The menu has 5 links. Each link points to the same website only body1, body2, body3 change depending on the menu link you press.

It makes no sense to create identical pages and point to each one. Iframes are out of the question. So, since php is the only thing I know (and not too well unforunately :P), then I'm guessing the solution lies with GET/POST and include.

Question is: HOW? :D

I'm sorry if the question is vague or requires too much writing but I can't seem to be able to write the code here because I keep stopping at a point where I wonder how I am supposed to tell the page to include a particular page. This requires an if statement. The contents of the containers (H F BODY1 ETC) depend on the menu link i press. So how do i do this?

Do i include a long if statement under div where div is for the wrapper that contains all 3 bodies.

This (http://www.dynamicdrive.com/forums/showthread.php?t=35624) post helped but not too much. I can't seem to fix on the solution. Maybe I should sleep on it then present you with a code tomorrow? At least to show I did my part :D A hint would be welcomed!

james438
03-06-2012, 05:56 AM
Hint:

www.mysite.com/?ID=4



<?php
$ID=$_GET['ID'];
if ($ID=='4') include body4.txt;
if ($ID=='3') include body3.txt;
if ($ID=="") include body_default.php;
?>