开发者

number formating problem in php and ajax

开发者 https://www.devze.com 2023-01-09 12:51 出处:网络
i have one text box formated with follwoing syntax $(\"#cont_dt\").blur(function(){ $(this).format({format:\"#,###.00\", locale:\"us\"});

i have one text box formated with follwoing syntax

       $("#cont_dt").blur(function(){
      $(this).format({format:"#,###.00", locale:"us"}); 
        })  

this work fine, for 开发者_如何学Cexample if i type 250000.50 it automatically formated to

    250,000.50

but the problem is when i try to pass same value to php file via ajax to add record in mysql i got error.

i think i need to bring 250,000.50 again in 250000.50 format to store in mysql.

how can i do this?

Thanks

          **EDIT**

dear all i need ajax / java script function to remove , not php function. thanks for help


simply .format() the element onSubmit


Pass PHP the non-formatted number instead or remove the comma with str_replace(",","", $number).


What is field type of the field your using to store this value in your mysql table?

Using int, double or decimal you'll not be able to store the value with the comma. If you are set on storing the value with the comma, versus just formatting the number upon pulling it out of the table, then you can change the field type to varchar.

0

精彩评论

暂无评论...
验证码 换一张
取 消