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

Link to comment
Share on other sites

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'>";

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.