I have a form whereby a user fills it in and clicks submit. This then stores the information in the database. I have a field called height. And I want the user to type in something like 10, but I dont want them to type in the measurement aswel. I want this to be added to ’10’ before storing in the database
So when they click 10 and submit, i want it to show in the database as 10inches or 10″.
I tried to google it but I get nothing because I have to be quite specific with keywords and I just dont know how to search it.
Does anybody know how I can achieve this?
Why do you want to store this in the database as text? That should not be a database concern, but instead be a UI concern. Store the 10, and just add the
incheswhen you pull the data out?Or you could store the 10 as a value alongside a mapping to what type it is (such as inches/cm/etc). This design will give you much more flexibility