Click here to Skip to main content
15,847,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a drop down list and i want to keep the state when it is posted. i have a radio button which is working and im using this code:


PHP
<td><Input type='Radio' Name="optionr" value="t3" <?= (isset($optionr) && $optionr == "t3")? 'checked' : '' ?> />3 tables</Input>
					</td>



PHP
<div>
                            <select name="txtcc"  >
                            <?php
                            print ("<option>Select</option>");
                            while ($row=mysql_fetch_row($allcc))
                            {

                                $Name = $row[0];
                                print ("<option value='$Name'>$Name</option>\n");
                            }
                            ?>
                            </select>
                        </div> <br />


any help please?
Posted

1 solution

hi ,

you can use selected property of add, if condition in while loop and compare $_POST['txtcc'] and matches,print option with
PHP
<option selected=""> </option>

Thanks :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900