Results 1 to 2 of 2

Thread: Show Div based on URL

  1. #1
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Show Div based on URL

    I would live to show a Div based on the URL.

    I'm using PHP to update a database and the page just refreshes when it's done. I'd like to set the URL to something like http://www.whatever.com/update.php?id=5&ud=y

    So if the URL had ud=y in it, it would show a div with a specific ID.

    Thank you!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    No javascript required:

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    #specific {
    display: <?php
    $theDisplay 
    = isset($_GET['ud'])? $_GET['ud'] : '';
    echo 
    $theDisplay === 'y''block' 'none'?>;
    }
    </style>
    </head>
    <body>
    <div id="specific">
    I'm Specific.
    </div>
    <div>
    Some other stuff.
    </div>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •