Page 1 of 1

Searching text

Posted: Sat Feb 26, 2005 9:48 pm
by anthony88guy
http://nokidding.websiteallies.com/bankingcalc.html

I have a calculator that I have made, when someone enters a comma in with any of the text, it doesn't calculate right anymore. So how do i search text for a ","?

Posted: Sat Feb 26, 2005 9:55 pm
by feyd
you mean enters a comma in a number? strip the text field of all non-numbers.. or error out..

Code: Select all

$text = preg_replace('#\D#', '', $text);

Posted: Sun Feb 27, 2005 8:09 pm
by anthony88guy
I would like to know how to add comma's to numbers, and if someone enters a number with a comma is get rid of it.

Posted: Sun Feb 27, 2005 9:14 pm
by feyd