Results 1 to 3 of 3

Thread: navigation help

  1. #1
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default navigation help

    hi here i want to know some script about navigation

    well i have a div tag and it has some texts and links in it, so i want to do is when i click on the link it should open up the link page into this current div...

    anybody can help me out please? well if its not possible using PHP please help me in that case also

    thank you

  2. #2
    Join Date
    Oct 2006
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I actually might have an answer for this one!

    What I have been using is a XHTML/PHP combo using the following:

    Code:
    <!-- XHTML Form -->
    <form name="navForm" action="post" method="navigate.php">
    <input type="hidden" name="pageHint" value="" />   <!-- This serves as a buffer to hold the hinted page name -->
    <input type="button" value="Home" onClick="javascript:pageHint.value = 'home';" />   <!-- This changes the value of the pageHint field -->
    <input type="button" value="About Us" onClick="javascript:pageHint.value = 'aboutus';" />   <!-- This changes the value of the pageHint field as well -->
    <!-- ... Fill in as many buttons as you want here, following the examples above -->
    <input type="submit" name="navSubmit" value="Go" />
    </form>
    And the PHP: (navigate.php)
    PHP Code:
    <?php
    if (!$_POST['navSubmit'] || !$_POST['pageHint'])
    {
       die();   
    // Kill it!
    }
    $page $_POST['pageHint'] . '.php';   // Takes the name string (i.e. 'aboutus') and tacks a PHP file extension onto it (i.e. 'aboutus.php')
    if (!is_file($page))
    {
       die();   
    // Kill it with FIRE!
    }
    else
    {
       include(
    $page);
    }
    ?>

  3. #3
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks ninja, this will work

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
  •