php - Currency symbol conflicting price validation field -


i put usd before every price (numbers)

 $product_price="usd".mysql_real_escape_string($_post['product_price']); 

now validated as

if(!is_numeric($product_price))         {             $errormessage[]="price must in numbers";         } 

its running if statement. how can usd every price user should restricted can add numbers.

you check value see if it's numeric before add "usd" prefix.

like this...

if(is_numeric($product_price)) {     $product_price="usd".mysql_real_escape_string($_post['product_price']); } else {     $errormessage[]="price must in numbers"; } 

Comments