Msg#: 4235454 posted 10:12 pm on Nov 26, 2010 (gmt 0)
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.
Msg#: 4235454 posted 11:16 pm on Nov 30, 2010 (gmt 0)
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).