I would like 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.

Any suggestions?

Recommended Answers

All 3 Replies

<?php if(isset($_post['ud'])) {
if(($_post['ud']=='first allowed entry')||($_post['ud']=='second allowed entry')||($_post['ud']=='third allowed entry') ) { include("$_post['ud'].php"); }
}
else include("default.php");
?>

permitted values include a php scrap containing the html appropriate to the value
there can be any number of acceptible values and insert pages
its not pretty, but its a thought concept

<?php if(isset($_post['ud'])) {
if(($_post['ud']=='first allowed entry')||($_post['ud']=='second allowed entry')||($_post['ud']=='third allowed entry') ) { include("$_post['ud'].php"); }
}
else include("default.php");
?>

permitted values include a php scrap containing the html appropriate to the value
there can be any number of acceptible values and insert pages
its not pretty, but its a thought concept

Interesting concept, I guess I never thought of doing it via PHP. I was thinking about Javascript, but I like the php version due to browser compatibility.

Thanks for the idea!

welcome

or use an array of ud/html

<?php
$UD = array(
'yes' => 'this way up',
'no' => 'other way up',
'up' => 'down',
'down' =>	'up',
'green' => 'red',
'red' => 'green'
);

if(all_condtions_as_b4) { echo $UD["$_post['ud']"]; } ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.