Jump to content

Performing an action upon GET autochange dropdown


dc_jt

Recommended Posts

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>

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

}
?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.