• Resolved bhavlice

    (@bhavlice)


    I have a problem in PHP. The dropdown list does not diplay properly after I submit a form. I want the selected value to re-display as the selected dropdown item. The problem is the option displayed is text and the option value is numeric which is sent to the database. The following represents my problem:

    the select input:

    <select name="idcategory" id="idcategory" tabindex="11">
    	<option value="0">All Categories</option>
    	<option value="1">Some Categories</option>
    </select>

    The code to redisplay the selected value:

    echo "<script type='text/javascript' language='javascript'>";
     	echo "document.forms['SearchForm']['idcategory''].selectedvalue='" . $_POST['idcategory'] . "' ";
        	echo "</script>";

    [Please post code snippets between backticks or use the code button.]

    Thanks,
    Bill

The topic ‘dropdown list selected value problem’ is closed to new replies.