slyte33 Posted February 28, 2010 Share Posted February 28, 2010 Hello, I am making a new mmorpg game and I was curious if it is possible to use commas in textboxes, and then when submitting the data, strip the commas and submit. This way, if a player has... $1,000,000 and they want to deposit it in their bank, they could simply enter 1,000,000 and not 1000000. I hope this explains it, and help is much appreciated. Thanks, Slyte Link to comment https://forums.phpfreaks.com/topic/193673-using-commas-in-textbox-and-submitting-data/ Share on other sites More sharing options...
inversesoft123 Posted February 28, 2010 Share Posted February 28, 2010 $richman = "10,00000,000000,000000"; $richman = str_replace(",","",$richman); echo "$richman"; Link to comment https://forums.phpfreaks.com/topic/193673-using-commas-in-textbox-and-submitting-data/#findComment-1019414 Share on other sites More sharing options...
slyte33 Posted February 28, 2010 Author Share Posted February 28, 2010 Works perfect, thanks! Link to comment https://forums.phpfreaks.com/topic/193673-using-commas-in-textbox-and-submitting-data/#findComment-1019417 Share on other sites More sharing options...
alpine Posted February 28, 2010 Share Posted February 28, 2010 You should probably also convert periods (.) and dont rely on everyone using commas In addition i would remove whitespace etc. $text = trim(str_replace(array(",","."), "", $text)); Link to comment https://forums.phpfreaks.com/topic/193673-using-commas-in-textbox-and-submitting-data/#findComment-1019420 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.