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 Quote Link to comment 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']); Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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.