dc_jt Posted May 18, 2007 Share Posted May 18, 2007 Hi Ive got the following drop down menu and I want to perform an action every time someone uses the dropdown. How Can I determine when it has been used? Normally I would pass in a mode but because its GET, I cant and if i change it to POST, it doesnt work how I want it to? Thanks <select name="iCat_Id" onchange="CatChange.submit()"> <option value="0">-- All Offers --</option> <?php //Get categories for this site $rCategories = $oTblCategories->GetCategories(); while ($oCategories = mysql_fetch_object($rCategories)) {?> <option value="<?=$oCategories->category_id?>"<?=($iCatId == $oCategories->category_id)?' selected="selected"':''?>> <?=$oCategories->category ?></option> <?php } ?> </select> </form> Quote Link to comment https://forums.phpfreaks.com/topic/51967-performing-an-action-upon-get-autochange-dropdown/ Share on other sites More sharing options...
dc_jt Posted May 18, 2007 Author Share Posted May 18, 2007 Anyone know? Im just looking for something like if($_GET['sMode'] == 'something') { //Do something here } But need to know what the if statement is for an onchange function?? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/51967-performing-an-action-upon-get-autochange-dropdown/#findComment-256164 Share on other sites More sharing options...
Barand Posted May 18, 2007 Share Posted May 18, 2007 the "if" statement is the same as if the form were submitted using a submit button. All PHP gets is submitted data. As the name of the drop-down is "iCat_Id" then <?php if($_GET['iCat_Id'] == 'something') { //Do something here } ?> Quote Link to comment https://forums.phpfreaks.com/topic/51967-performing-an-action-upon-get-autochange-dropdown/#findComment-256184 Share on other sites More sharing options...
dc_jt Posted May 18, 2007 Author Share Posted May 18, 2007 Thanks for the reply, I already know that. My drop down works fine but its when I change pages I wanted to set the start to 0 when the category is changed. I have done it now however by passing in a hidden mode and then doing if($_GET['mode'] == changeFilter) { $iStart = 0; } Thanks anyway for your help Quote Link to comment https://forums.phpfreaks.com/topic/51967-performing-an-action-upon-get-autochange-dropdown/#findComment-256185 Share on other sites More sharing options...
Barand Posted May 18, 2007 Share Posted May 18, 2007 Ah!. Sorry. I understand what you were trying to do now Quote Link to comment https://forums.phpfreaks.com/topic/51967-performing-an-action-upon-get-autochange-dropdown/#findComment-256187 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.