Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Validating an input field for money


Monika in Germany

Recommended Posts

Hi,

 

does anyone have a script ready to validate a form field (input field) so it it in the money format ready to be entered into the DB? I need to make sure no letters are used. I would like to make 2 separate fields with a dot in between and validate each so it only contains numbers, and of course the second one is < 100.

 

I'd hate to make it and find a script later ;-).

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

take a look in the php.net through the eregi and similar functions they post script examples. I've seen one

 

http://www.php.net/manual/en/function.eregi.php

 

but mentions use of the ctype.h in php and so depends on the available extensions. However there is a bunch of others for number formats/validation that may help

 

thx m8, that was a cool link.

 

in the end I went with an easy but wonderful comparing of the value and the (int) of the value ... worked just as sweet as needed.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...