dk4210 Posted February 8, 2011 Share Posted February 8, 2011 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 https://forums.phpfreaks.com/topic/227095-adding-a-submit-button-to-the-multi-drop-select-boxes/ Share on other sites More sharing options...
dk4210 Posted February 9, 2011 Author Share Posted February 9, 2011 Anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/227095-adding-a-submit-button-to-the-multi-drop-select-boxes/#findComment-1171750 Share on other sites More sharing options...
ale8oneboy Posted February 9, 2011 Share Posted February 9, 2011 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 https://forums.phpfreaks.com/topic/227095-adding-a-submit-button-to-the-multi-drop-select-boxes/#findComment-1171764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.