caspernova Posted April 3, 2006 Posted April 3, 2006 i know this is an odd question... but does anyone know how to pre-select a certain choice from a drop down menu when you enter a page based on the link that the page came from? like, if there were a choice of cars, and when you clicked on one, say "Chevy", you were sent to "sell.htm#dropdown:Chevy", and when you got to the page, "Chevy" was preselected from the drop-down menu... (the part in bold is what i'm not sure about, but you get the idea.) does anyone know how to set this up, if it's possible?
kgt Posted April 3, 2006 Posted April 3, 2006 This is doable but depends on the actual page and code involved. Basically, you do this using PHP. URL: sell.php?selected=chevy sell.php <select name="manufacturers"> <option value="chevy"<?php echo $_GET['selected'] == 'chevy' ? ' selected' : ''; ?>>Chevy</option> <option value="ford"<?php echo $_GET['selected'] == 'ford' ? ' selected' : ''; ?>>Ford</option> </select> The exact method will depend on the code. Contributions Discount Coupon Codes Donations
boxtel Posted April 3, 2006 Posted April 3, 2006 This is doable but depends on the actual page and code involved. Basically, you do this using PHP. URL: sell.php?selected=chevy sell.php <select name="manufacturers"> <option value="chevy"<?php echo $_GET['selected'] == 'chevy' ? ' selected' : ''; ?>>Chevy</option> <option value="ford"<?php echo $_GET['selected'] == 'ford' ? ' selected' : ''; ?>>Ford</option> </select> The exact method will depend on the code. I do this for my product types box: if (isset($_GET['type'])) { $typeset = $_GET['type']; } elseif (isset($the_product_info['products_type'])) { $typeset = $the_product_info['products_type']; } else { $typeset = ''; } and for the dropdown: tep_draw_pull_down_menu('type', $types_array, $typeset , 'onChange="this.form.submit();" ') . Treasurer MFC
caspernova Posted April 3, 2006 Author Posted April 3, 2006 This is doable but depends on the actual page and code involved. Basically, you do this using PHP. URL: sell.php?selected=chevy sell.php <select name="manufacturers"> <option value="chevy"<?php echo $_GET['selected'] == 'chevy' ? ' selected' : ''; ?>>Chevy</option> <option value="ford"<?php echo $_GET['selected'] == 'ford' ? ' selected' : ''; ?>>Ford</option> </select> The exact method will depend on the code. kgt - THANK YOU SO MUCH!!!!! Your code worked perfectly! I am so happy to make this little improvement to my site... much thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.