jacktheripper125 Posted August 7, 2009 Share Posted August 7, 2009 Hi I have a old payment system that i use but customers keep putting in £ and the protx wont allow them. so i have tried to use the preg_replace to remove it but i just cant get it to work. I have tried to add it to this line <INPUT TYPE="hidden" NAME="Amount" VALUE="<? echo($ThisAmount); ?>"> after the echo along the lines of <INPUT TYPE="hidden" NAME="Amount" VALUE="<? echo preg_replace('£', '',$ThisAmount); ?>"> I am clearly being dumb but i am just not sure how dumb and in what way. any help would be hugely aprecheated. thank you Ian Quote Link to comment https://forums.phpfreaks.com/topic/169218-solved-i-cant-get-preg_replace-to-work-and-it-is-driving-me-mad-plz-help/ Share on other sites More sharing options...
micah1701 Posted August 7, 2009 Share Posted August 7, 2009 try adding some slashies <?php echo preg_replace('/£/', '',$ThisAmount); ?> does that help? Quote Link to comment https://forums.phpfreaks.com/topic/169218-solved-i-cant-get-preg_replace-to-work-and-it-is-driving-me-mad-plz-help/#findComment-892897 Share on other sites More sharing options...
alexdemers Posted August 7, 2009 Share Posted August 7, 2009 Use PHP: str_replace - Manual instead for a simple replace. Quote Link to comment https://forums.phpfreaks.com/topic/169218-solved-i-cant-get-preg_replace-to-work-and-it-is-driving-me-mad-plz-help/#findComment-893008 Share on other sites More sharing options...
jacktheripper125 Posted August 7, 2009 Author Share Posted August 7, 2009 EXCELLENT HAVE SORTED IT WITH <INPUT TYPE="hidden" NAME="Amount" VALUE="<? echo str_replace('£', '',$ThisAmount); ?>"> this strips out the £ sign, THANK YOU, THANK YOU, FOR YOUR HELP I can now have my weekend happy with the site fixed p.s. THANK YOU Quote Link to comment https://forums.phpfreaks.com/topic/169218-solved-i-cant-get-preg_replace-to-work-and-it-is-driving-me-mad-plz-help/#findComment-893063 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.