I have a form that combines java script and php to make calculations and then stores them in a database. On my tables, i have different options the user can select. For example, the 2 ton Unit has a value of 1492.
<option value="1492">2 Ton Unit</option>
My problem is that when values are being passed on to the database, it automatically passes the "value" instead of the name which makes sense. However, I would like "2 Ton Unit" to be stored instead of the number. Any suggestions to make this happen? I then send an email to the user with his/her selections and all they see is numbers which don't make a lot of sense.
Create a lookup table that matches the numeric value with the text description. Something like: UnitID Description ------ ----------- 1492 2 Ton Unit
In most cases, you want to store the actual numeric value in your database- numeric values are faster to search and you don't need to change all your data if the description changes (you just make one change in the lookup table).