• I have the code below in a form. The select box is used to select a category or if the last option is selected it displays an input to add a new category.

    I need the select box to be sticky (if they hit send but but has errors it keeps the value selected.

    Thanks for any help!

    <select name='categories-1' id='categories-1' class='categories-1' size='1' onchange="displayNewCat(this);">
       <option class="green" value="">Select/Add category</option>
       <?php
    	$categories=  get_categories('child_of=4');
    	foreach ($categories as $cat) {
    	   $option = '<option value="'.$cat->cat_name.'">&nbsp;&nbsp;&nbsp;&nbsp;';
    	   $option .= $cat->cat_name;
    	   $option .= ' ('.$cat->category_count.')';
    	   $option .= '</option>';
    	   echo $option;
    	}
       ?>
       <option disabled="disabled" class="green">Add New</option>
       <option value="new">&nbsp;&nbsp;&nbsp;&nbsp;Click Here to Add New </option>
    </select>
  • The topic ‘Sticky form dropdown’ is closed to new replies.