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 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? 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. 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 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
Archived
This topic is now archived and is closed to further replies.