Welcome Guest, Not a member yet? Register   Sign In
An experiment about translation special characters among html,php and mysql. Some problems.
#1

[eluser]huaxz1986[/eluser]
First I get data from html:
Code:
addslashes($POST['text'])
I found that mysql_real_escape_string() can work too, but there is no function to delete the '\' that mysql_real_escape_string() add.
Second insert data into MYSQL.

The reverse action:
First get data from MYSQL:
Code:
stripslashes($result['text'])
Then show data in html,with htmlspecialchars() and nl2br().
Finally, I surprisingly see that some of data is shown with entity in html, not characters such as < > ' ".However some of data is shown correctly.
That is why?

#2

[eluser]pbflash[/eluser]
Are you using active record to insert and select from the db? If you are the data is automatically escaped.
#3

[eluser]InsiteFX[/eluser]
Also you should be using CodeIgniter's $this->input->post('item', TRUE)




Theme © iAndrew 2016 - Forum software by © MyBB