aashcool198 Posted June 5, 2009 Share Posted June 5, 2009 I have created a program in which user can create his profile and edit it. There is one dropdown box. <select name="dep" > <option value ="">Please Select</option> <option value ="Devlopers">Devlopers</option> <option value ="web">Web</option> </select> What i want that when the user clicks on edit profile. In edit page the value shown in combo-box should be same as what he filled in previously. using database (where the previous value is stored) how can i do this? Please help! Quote Link to comment https://forums.phpfreaks.com/topic/161032-edit-data-in-database/ Share on other sites More sharing options...
Daniel0 Posted June 5, 2009 Share Posted June 5, 2009 For each option, check if the value corresponds to the previously selected value. If it does, mark it as selected. Quote Link to comment https://forums.phpfreaks.com/topic/161032-edit-data-in-database/#findComment-849823 Share on other sites More sharing options...
aashcool198 Posted June 5, 2009 Author Share Posted June 5, 2009 can you show me by writing 1-2 lines please. Quote Link to comment https://forums.phpfreaks.com/topic/161032-edit-data-in-database/#findComment-849827 Share on other sites More sharing options...
Daniel0 Posted June 5, 2009 Share Posted June 5, 2009 <option value ="Devlopers"<?php if ($value == 'Devlopers'): ?> selected="selected"<?php endif ?>>Devlopers</option> Quote Link to comment https://forums.phpfreaks.com/topic/161032-edit-data-in-database/#findComment-849830 Share on other sites More sharing options...
aashcool198 Posted June 5, 2009 Author Share Posted June 5, 2009 hey ! thanks a lot..it worked... But selected doesn't work in radio buttons for that what do i have to do? Quote Link to comment https://forums.phpfreaks.com/topic/161032-edit-data-in-database/#findComment-849838 Share on other sites More sharing options...
Daniel0 Posted June 5, 2009 Share Posted June 5, 2009 It's called checked instead. Quote Link to comment https://forums.phpfreaks.com/topic/161032-edit-data-in-database/#findComment-849870 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.