Jump to content

Adding a submit button to the multi drop select boxes


dk4210

Recommended Posts

Hello,

 

I have the following function

function make_agent_drop($dropname,$parent=''){
$agents = mysql_query("SELECT * FROM ad_category WHERE cat_status='1'  AND parent_id='".(is_numeric($parent)?$parent:"0")."'") or die(mysql_error());
$anum = mysql_num_rows($agents);
if($anum>0){
	$agentdrop='<select style="width:150px; height:20px; margin-left:100px; font-size:11px;" name="'.$dropname.'" id="'.$dropname.'" class="text" '.(is_numeric($parent)?'':'onchange="update_subcatdrop($(this).val());').'">
	<option value="0">Select a Category</option>';
	while($row= mysql_fetch_array($agents)){
		$agentdrop.='<option value="'.$row['cat_id'].'">'.$row['cat_name'].'</option>';
	}
	$agentdrop.='</select>';

}else{
	$agentdrop= 'No '.(is_numeric($parent)?'Sub':'').'Categories Found.';
} 
return $agentdrop;

;
}

 

I creates a drop down from database cats and sub cats..  I am trying to figure out how to add a submit button to dynamically appear when it displays the sub category...

 

Thanks!

Dan

Pardon me if I don't completely understand what you're trying to do. But if you're trying to add a submit button for when the select box is returned, would you just append the html to $agentdrop in the true condition? Or maybe you could check for to see if the function returns a select box and write a condition where it displays a submit button. Just some food for thought.

 

Possible Easy Solution:

after: $agentdrop.='</select>';

add: $agentdrop .= "<input type='submit' value='Submit'>";

 

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.