Hello all,
well sometimes user insert information like "name" in the database because of which it causes problem in the site. So anyone tell me how to resolve this problem. I have already used addslashes.

Recommended Answers

All 3 Replies

addslashes simply puts a slash before it.
what you need to do is when echoing to the browser convert those symbols to html

<?PHP
$var = 'this\'s some "users content"'
$var = str_replace('"','"', $var);
$var = str_replace("'", ''', $var);
?>

I created a very short tutorial (pretty much just a code reference) at my site

hey this I have already tried it works for 1st time or sometime site doesn't open properly and when u edit it again it won't display. I am so sick and tired of this problem. plz give me some long lasting solution if anyone knows. Anyways thanx metalix but this don't work!!

oh sorry I just looked at it and didn't realise daniweb wasn't set up to handle html code references.
I attached a file with the char list. view that tutorial for more details.
you can also use the hex (hx) for example where space is 20, use %20

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.