CodeIgniter Forums
handling form values - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: handling form values (/showthread.php?tid=25076)



handling form values - El Forum - 11-30-2009

[eluser]crwtrue[/eluser]
Is this a good solution?

I have a form that has an input field where user can submit a decimal value like 12.12 and this value is then inserted to mysql table. The problem is if user use comma in his value like 12,12. So i was thinking of doing a if-else check with regular expression to change value that has comma to dot.


handling form values - El Forum - 11-30-2009

[eluser]sico87[/eluser]
could you not just do str_replace() something like,

Code:
str_replace(",",".",$fDecimalValue);



handling form values - El Forum - 11-30-2009

[eluser]crwtrue[/eluser]
thx for reply. yeah thats seems even better solution.