Long story short, part of the site I'm designing takes input from the user in the form of a textarea and posts the inputted text to a MySQL table.
When you SELECT the data back from the dB, apostrophes are being slashed out (i.e. Wouldn/'t instead of wouldn't) and I don't know how to stop it doing this. The same goes for the pound sterling symbol which is displayed as a square.
I know that the ASCII code for an apostrophe is ' and the ASCII code for a pound sterling symbol is £
Is there any way of having my PHP check the inputted text and convert any apostrophes or sterling symbols with their ASCII equivalent?
Thanks in advance.
Apoostrophes in textarea
Moderator: General Moderators
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: Apoostrophes in textarea
It looks magicquote is enabled on your server. The easiset thing is to use stripslashes on the data you are receiving from the database.
Re. £ symbol, you can do a preg_replace before inserting data into DB, to replace the £ with its ASCII equivalent.
Re. £ symbol, you can do a preg_replace before inserting data into DB, to replace the £ with its ASCII equivalent.