zgkhoo Posted November 2, 2007 Share Posted November 2, 2007 index.php <form action='index.php' method='post'> <select name='LANG'> <option value='EN'>English</option> <option value='CH'>Chinese</option> </select> <input type=submit name=submit value=submit> </form> when i select Chinese then click the button, then it auto jump back to English, how to i set it to remain display the Chinese in this select box after button clicked? thanks.. Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 2, 2007 Author Share Posted November 2, 2007 *bump* Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 3, 2007 Share Posted November 3, 2007 Your going to have to add some PHP to the form. <form action='index.php' method='post'> <select name='LANG'> <option value='EN'>English</option> <option value='CH' <?php if ($_POST['LANG'] == 'CH') echo 'selected'; ?>>Chinese</option> </select> <input type=submit name=submit value=submit> </form> Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 3, 2007 Author Share Posted November 3, 2007 how about this <option value='CH' 'selected'>Chinese </option> it wont work? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 no it won't work Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 3, 2007 Author Share Posted November 3, 2007 then wat is this 'selected' keyword for in the select box? thanks Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 to select a particular option in the box 'selected' won't work just selected does won't work <option value='CH' 'selected'>Chinese </option> this works <option value='CH' selected>Chinese </option> Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 3, 2007 Share Posted November 3, 2007 <option value="CH" selected="selected">Chinese</option> is how it shoudl be implemented (in a standards compliant kind of way that is). Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 sorry dude standard I know we know the standards but it becomes hard when posting mulitple times Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 3, 2007 Share Posted November 3, 2007 I hear ya... even if I don't accept excuses Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.