PDA

View Full Version : Show Div based on URL



agr8lemon
04-29-2010, 02:00 PM
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!

jscheuer1
04-30-2010, 11:24 AM
No javascript required:


<!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>