Fixing dynamic Drop downs generated in php

hey folks, i m working of website and the other guy created dynamic drop down menu, creating function, now if i class them up in css, i have issue with width’s of drop down’s in browsers, in css i can put a exception in the header of the page that if its IE do this but now its dynamic generated. how can i give it exception of how and how. here is the current function

function CreatePriorityddl($name, $priority, $type)
{	$instance = new database();
	$connection=$instance->connect();
	$result = $instance->query("select * from sitepriority where status=1 order by Priority");
	if($type == 1)
		print('<select class="txtfield" style="width:11em" name="'.$name.'" id="'.$name.'"><option value="0">Select Priority</option>');
	if($type == 2)
		print('<select class="txtfield-blue"  name="'.$name.'" id="'.$name.'"> <option value=0>Select Priority</option>');
	while($values= mysql_fetch_array($result, 1))
	{
		if($priority == $values['PriorityId'])
		{
			print('<option value="'.$values['PriorityId'].'" selected="selected" >'.$values['Priority'].'</option>');
		}
		else
		{
			print('<option value="'.$values['PriorityId'].'">'.$values['Priority'].'</option>');
		}
	}
	print ("</select>");
	$instance->close();
	unset($instance);
}

You don’t need PHP at all. The select box already has a CSS class name.
In your HTML head add a conditional comment (do a Google search for IE conditional comments) to serve a style sheet to IE only. In that CSS doc you should target .txtfield and .txtfield-blue to get the styling to your needs.

The function you’ve posted doesn’t need to be modified.

well its more of coping up with cross browsers issues. in FF its ok but in IE the width is shorten, what i need is a if statement for IE, for my dynamic php values. so the width are equal in IE as well as FF

i don’t get the part on how do i call upon that class on a dynamic php. here is how it is calling from those function

<td><?php 													CreateCategoryddl("ddlCategory", '', 1);															?>
</td>  

If you just need an IE conditional style sheet you don’t need to modify any of the code you have posted. Put the conditional CSS in the header, and have it target the select box (drop downs are different, this isn’t one of them).

I don’t know what you are trying to do. The <select> box has a class of txtfield or txtfield-blue (depending on $type). Do you want to target that with CSS, or do something else?