Portal Home > Knowledgebase > Articles Database > Help with HTML forms


Help with HTML forms




Posted by JerseyPerks, 09-06-2008, 04:16 PM
I have a HTML form that has a menu/select field with some options: So for example, if the user selects Ocean Front King - $75, the value is $75. However, the value that gets saved into my database is 75, and not 'Ocean Front King - $75' ... Is there anyway to save the Item Label instead of the value ??? Or any workaround?

Posted by SolidTools, 09-06-2008, 05:01 PM
Check your database field, is it decimal or varchar?

Posted by JerseyPerks, 09-06-2008, 05:08 PM
varchar, why does that make a difference? the html form saves the 'input value', but i want to save the 'item label'

Posted by SolidTools, 09-06-2008, 05:55 PM
Sorry, I misunderstood. I think the $ sign is striped by PHP. are you using PHP? Last edited by SolidTools; 09-06-2008 at 06:03 PM.

Posted by SolidTools, 09-06-2008, 06:01 PM
Try to replace the "$" with "& # 3 6;" (remove the space) I'm sure there is a better solution, but I'm not good with PHP.

Posted by JerseyPerks, 09-06-2008, 06:29 PM
in my example, my values are 75.00001, 75.00002, etc. etc. this is what gets saved to the database, but I'd rather have the text that goes along with it get saved instead Ocean Front Double Bed - $75 The values are numbers because I am doing some form calculation also. thanks

Posted by qualityhosts, 09-06-2008, 06:49 PM
the form will post the values and not the text that goes along with it, you can use some javascript to change the values to the text you want? You need to find a way to put the text as the value if not part of the value or maybe post the text as a hidden field or something.

Posted by bear, 09-06-2008, 07:11 PM
Whatever is in the value field is what will be passed by the script/form, so pass that info, IE: Not But instead: An alternative would be to catch the numeric value with PHP, and use that to rewrite the value that gets stored, after you perform your calculations. Last edited by bear; 09-06-2008 at 07:15 PM.

Posted by JerseyPerks, 09-06-2008, 07:16 PM
can someone assist with whatever they are recommending?



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Anyone know about WHM? (Views: 604)

Language: