unidox Posted August 5, 2008 Share Posted August 5, 2008 I was wondering how I can do this: I have alot of options inside a select, and I need to have the values like: <option <? if($r['name'] == option value) { echo "selected = selected"; } ?> value = "John"> but the problem is, how can I find the value without typing the name in for each option. Thanks Link to comment https://forums.phpfreaks.com/topic/118270-function/ Share on other sites More sharing options...
niranjnn01 Posted August 5, 2008 Share Posted August 5, 2008 could you explain your requirement a little more?... Link to comment https://forums.phpfreaks.com/topic/118270-function/#findComment-608619 Share on other sites More sharing options...
unidox Posted August 5, 2008 Author Share Posted August 5, 2008 Ok, I have a dropdown like this: <select name="name"> <option value="John"> </select> but I have over 400 options from the drop down. I was wondering if there was a way I can make it selected if the user already selected it. Because lets say I add a user, it adds the name John in the db. When I want to edit the user, I dont want to sort through all the names, I am trying to have it selected if the value matches the database. How can I do that? Thanks Link to comment https://forums.phpfreaks.com/topic/118270-function/#findComment-608622 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.