Looking to select a drop down menu item based on the url the user enters the page from
I have 10 different camp sites on a client site, I want to select a camp location based on where they what camp site they click on "registration form" from.
Currently it is a 10 item drop down, and I am looking to either do this through a url parameter (foo.com/test.html?camp=value) or something like that, 开发者_JAVA技巧but I cannot figure this out.
Hope fully you guys and gals can come through for me again!
Something like this if you are using php (using query string ?camp=value):
<?php
$camp = isset($_GET['camp']) ? $_GET['camp'] : NULL;
$sel = ' selected="selected"';
?>
<select>
<option value="value1"<?php if ($camp === 'value1') echo $sel; ?>>
Value 1
</option>
<option value="value2"<?php if ($camp === 'value2') echo $sel; ?>>
Value 2
</option>
</select>
Not sure if you're using php, but maybe this will help anyways.
精彩评论