Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating price variable...

Status
Not open for further replies.

youradds

Programmer
Joined
Jun 27, 2001
Messages
817
Location
GB
Could someone please point me in the right direction, as to why this is not validating 2dp price values entered;

if (!preg_match("/^[\d]{1,8}\.[\d]{,2}/",$Price)) { error_page("Please enter a valid price. It need to be to 2 decimal places..."); }

Thanks in advance :)

Andy
 
try this
Code:
if (!preg_match("/^[\d]{1,8}\.[\d]
{2}
Code:
/",$Price)) {

error_page("Please enter a valid price. It need to be to 2 decimal places..."); 
}

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top