how do I translate the category names into integer to be stored in the book table?

I have a database with three tables; books, categories and authors.
instead of storing author and category names inside the book table I simply reference them using author_id and category_id respectively.
Books will be added via a form, and one of the form input is category. Now it's unintuitive to use category_id because users don't know what each category_id will stand for so I simply displayed the available category within a selection tag so they can choose one of the available categories.
Here's the problem, the category_id in the book table expects an integer, how do I translate the category names into integer to be stored in the book table?
You already invited:

Dmitry

Upvotes from:

Why don't you use category_id in select tag?
 
<select name="category_id">
<option value="1">Comedy</option>
<option value="2">Drama</option>
<option value="3">Romance</option>
</select>

If you wanna answer this question please Login or Register