Web Analytics Made Easy -
StatCounter displaying corresponding pages - CodingForum

Announcement

Collapse
No announcement yet.

displaying corresponding pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • displaying corresponding pages

    Hai

    I am facing a problem.I have a PHP page and I am calling menu , header and body into that.

    in the body section I want the following links and when we click on that we can get the corresponding page.

    the body section will look something like this

    world | windows | linux | DOS|

    when i click on the world i should get the corresponding information below it and when i click on linux i shuld get the corresponding info.

    any kind of suggestion will be really helpful.

    Thanks

    urs
    sai

  • #2
    You'd have to be more specific. Where are you getting the Windows or DOS or Linux information from? a database?

    let's say your page is called something.php

    this is one approach:
    PHP Code:
    ...
    <body>
     <a href="something.php?display=world">world</a>
     <a href="something.php?display=windows">Windows</a>
     ...

     <?php
      
    if(isset($_GET["display"])) {
       if(
    strcmp($_GET["display"], "world") == 0) {
        
    //put your world info here.. db queries, whatever..
       
    }
       else if(
    strcmp($_GET["display"], "windows") == 0) {
        
    //put your windows info here...
       
    }
       ...
      }
     
    ?>
    I suppose you could use a switch statement also..

    Hope that makes sense.
    Sadiq.

    Comment


    • #3
      Hey sadiq

      Thanks for that it was great !!!!!!

      I have worked thru all of that but still having a problem .

      I am calling my tech.php into the index.php

      and my tech.php has the following code



      tech.php
      ------------------


      <!-- Begin Left Menu -->
      <?php require("http://host/menus/top.php"); ?>
      <!-- End Left Menu -->




      <!-- Begin PhP content -->
      <div id="tech">
      <?php
      switch($HTTP_GET_VARS['page'])

      { /* Script courtesy of EvilWalrus.com */
      case '0':
      include ' http://host/content/home.php ';
      break;
      case '1':/* Alias for the actual page for security purposes */
      include ' http://host/content/win.php ';
      break;
      case '2':
      include ' http://host/content/linux.php ';
      break;
      case '3':
      include ' http://host/content/dos.php ';
      break;

      default:
      include ' http://host/content/home.php ';
      break;
      }
      ?>


      the top.php

      ---------------

      <table width=850 cellpadding="3">
      <tr align=center>
      <td align="center" width=132><a href="http://host/content/tech.php?page=0">Tech Home</a></td>

      <td align="center" width=5> | </td>

      <td align="center" width=132><a href="http://host/content/tech.php?page=1">Windows</a></td>

      <td align="center" width=5> | </td>

      <td align="center" width=132><a href="http://host/content/tech.php?page=2" >Linux</a></td>

      <td align="center" width=5> | </td>

      <td align="center" width=132><a href="http://host/content/tech.php?page=3"> DOS</a></td>

      <td align="center" width=5> | </td>

      <td align="center" width=302><a href="http://host/content/tech.php?page=4" > Free Downloadable Programs</a></td>
      </tr>


      </table>



      now the problem is

      it is not displaying home.php contents even when i have given the full path .

      and when i click on the links then it take me to the new page with only the top.php and the page which is clicked .

      I want that it shuld remain in the index.php and only the tech.php shuld change according to the contents .........

      any suggestions will be reallly great!!!!!!

      thanks

      urs
      sai

      Comment

      Working...
      X