# Edit form with listbox

**URL:** <https://forum.kirupa.com/t/edit-form-with-listbox/68941>\
**Category:** programming\
**Created:** [October 30, 2004, 2:18pm UTC](https://forum.kirupa.com/t/edit-form-with-listbox/68941 "2004-10-30T14:18:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [October 30, 2004, 2:18pm UTC](https://forum.kirupa.com/t/edit-form-with-listbox/68941/1 "2004-10-30T14:18:23Z")

</div>

Hi there,

I’m having a bit of a problem here. I’m trying to achieve something, but I don’t know how.  
Here’s the situation:

I have a MySql database, and a custom content management system. The user can add certain items to the database through list boxes in html. Now I want to make an edit form, so the user can go back and edit some of the values he entered. No problem with textfields and all that, but I want to have the listbox again on screen, with the value that was saved in the database…

Here is what the listbox looks like:

\<select name=“category” id=“category”\>  
\<option value=“0”\>Choose your item\</option\>  
\<option value=“1”\>Item 1\</option\>  
\<option value=“2”\>Item 2\</option\>  
\<option value=“3”\>Item 3\</option\>  
\<option value=“4”\>Item 4\</option\>  
\</select\>

And the values (0, 1, 2, 3 or 4) are saved into the db.  
So have do I set the value of the listbox to the value that was saved in the db?

Any help will be appreciated…  
Sintax :mu:
