purplenewt Posted September 20, 2008 Share Posted September 20, 2008 hi I kind of know what I need to achieve here just not sure how to accomplish it. Basically I have a text box and when users type into it it doesnt seem to understand characters like pound signs and things, so to fix this problem i am thinking some code that basically does something like: If £ found replace £ with £ and then repeat that for several character types but im just not sure how to go about it. Any help would be greatly appreciated, thanks. Purplenewt Link to comment https://forums.phpfreaks.com/topic/125066-solved-replacing-special-characters/ Share on other sites More sharing options...
dropfaith Posted September 20, 2008 Share Posted September 20, 2008 http://us.php.net/str_replace something like this the link above describes the method used $result = str_replace("£","£",$_POST['text']); Link to comment https://forums.phpfreaks.com/topic/125066-solved-replacing-special-characters/#findComment-646331 Share on other sites More sharing options...
purplenewt Posted September 20, 2008 Author Share Posted September 20, 2008 thanks I shall give that a try soon as I get the chance, unfortunatly ive just been called away to a job. thanks for your help. Purplenewt Link to comment https://forums.phpfreaks.com/topic/125066-solved-replacing-special-characters/#findComment-646336 Share on other sites More sharing options...
purplenewt Posted September 21, 2008 Author Share Posted September 21, 2008 thanks a ton I followed the link you gave and found a better way to get the job done than I had thought of. I was thinking I would have to do a lot of if else type coding for each character that wasn't displaying properly, on the link you gave me I found: // Provides: You should eat pizza, beer, and ice cream every day $phrase = "You should eat fruits, vegetables, and fiber every day."; $healthy = array("fruits", "vegetables", "fiber"); $yummy = array("pizza", "beer", "ice cream"); $newphrase = str_replace($healthy, $yummy, $phrase); which with a small amount of editing has saved me a ton of coding. now I just have to find out how to mark this thread as solved:) Thanks again Purplenewt Link to comment https://forums.phpfreaks.com/topic/125066-solved-replacing-special-characters/#findComment-646965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.