i am trying to make my input field for a monetary value fixed... i would like it to be something like:
$[blank text box here].[blank for cents]... i want the '$' and '.' to be fixed... does anyone know how i can do this? also, any suggestions on errors i should set when users are entering money values. i was going to do something like:
The most logical solution would be to provide two input boxes. One for the dollars and one for the cents. The cents could even be a select box (from 00-99).
If you only want one input box you could explode on the "."
* the value is not empty
* the value is numeric
* the cents part is between 00-99
* some places use a , instead of a .
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
okay so i took your advice and created two fields, one for the dollar amount and one for the cents... should i just make both of them int or should i set them up as decimal type in my db? i use mysql...
also, i made the following error message for the cents and i'm unable to input any two digit value from 00-99?? any ideas why? what is wrong with my error conditional statement?
if (!ereg("^[00-99]$", $_POST['amount_cents'])) {
$error['money_cents'] = 'Price cents field should be in 2-digit format. Example: Type 25 for 25 cents.';
}
if i create an extra field for the cents, then there is an extra field in my db, right? if so, then how do i link the two fields together to submit the price with my paypal 'buy now' form? any ideas?