treehouse : what would you like to learn today?
Web Design Web Development iOS Development

dynamic content

  • i want to control my content by click menu such as i click home and content will show about home.
    please help me what should i do



    following is is my menu.php code


    <div id="menu">

    <div id="menumain">
    <?php
    include_once('config.php');
    $result = mysql_query("SELECT * FROM page ");

    while($row = mysql_fetch_array($result))
    {
    ?>

    <a href="?pageid=<?php echo $row['id']; ?>"><?php echo $row['pagename']; ?> </a>

    <?php
    }

    ?>
    </div>
    </div>


    following is my index.php code
    <?php include_once('config.php');?>
    <?php include_once('header.php'); ?>

    <?php include_once('menu.php');?>

    <div id="content">
    <?php include_once('sidebar.php'); ?>

    <div id="maincontent">

    <!-- include_once('config.php');-->
    <?php

    if(isset($_GET['pageid']))
    {
    $result=mysql_query("select content from page where id='pageid'");
    echo '$result';
    }
    ?>


    </div>


    <div id="space"></div>
    </div>

    <?php include_once('footer.php'); ?>
  • I may be off base here, but given the last post of yours I read, it sounds like you want us to do the work for you. You obviously know some PHP and the sample code you gave basically has what you want; when you get a request with querystring pageid=5 you just want to pull out a different field from the database and since you already know how to get info from the database, that's not the issue; in fact, I'm not really sure what the problem is.