Results 1 to 2 of 2

Thread: place different containers in an html page using php

  1. #1
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default place different containers in an html page using php

    Good day,


    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?

    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 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 A hint would be welcomed!

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Hint:

    www.mysite.com/?ID=4

    PHP Code:
    <?php
    $ID
    =$_GET['ID'];
    if (
    $ID=='4') include body4.txt;
    if (
    $ID=='3') include body3.txt;
    if (
    $ID=="") include body_default.php;
    ?>
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •