Hi All,
I am not too sure if this is going to have a php solution or something simple in html, but here goes:
I have a drop down (select) menu, and have some choices of course, now when I select one, the page loads (using onchange event handler no button)...What I would like to know how to do is keep the selected choice as the default value, so let's say I have a default value currently as Choose an option, and I click option 1, how can I have the default value say option 1 instead of Choose an option as it currently stands?
Update, I tried using the following php code which does work on this, but when I apply it to my select menu, it defaults to the original default choice so I am wondering if this code could be modified to my needs:
PHP Code:
<select name="categories"> <option value="">Choose a category...</option> <option value="seo" <?php echo $result['categories'] == 'seo' ? 'selected' : ''?> >Search Engine Optimization</option> <option value="auto" <?php echo $result['categories'] == 'auto' ? 'selected' : ''?>>Autos</option> <option value="business" <?php echo $result['categories'] == 'business' ? 'selected' : ''?>>Business</option> <option value="design" <?php echo $result['categories'] == 'design' ? 'selected' : ''?>>Design</option>
Hope that explains it!
Thank you, and Happy Thanksgiving!
Brian
__________________
Made2Own
Last edited by Brian07002; 11-23-2012 at 12:09 AM..
|