html code entered into a form showing up strange in table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpstudent
Forum Newbie
Posts: 10
Joined: Wed Feb 04, 2009 11:54 pm

html code entered into a form showing up strange in table

Post by phpstudent »

So i have a form that i set up in mysql as a varchar, with 250 character limit. i am able to enter information into this field, but if i submit a url, it comes back strange.

say i enter the following into my form:
check out <a href="http://mysite.com/thispage.php">this page</a> today
once it hits the table it shows like this:
check out <a href=\"http://mysite.com/thispage.php\">this page</a> today
i have tried using varchar and text fields, and neither seems to be working.
any thoughts?
thanks
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: html code entered into a form showing up strange in table

Post by John Cartwright »

You have magic quotes enabled. It has been explanated a thousands times why it's bad so I won't bother (it even has a page in the manual -- "Why not to use Magic Quotes")

Simple answer: disable magic quotes. This can be done in your php.ini, or htaccess. I'm not sure if it can be configured at runtime (I don't think so).
phpstudent
Forum Newbie
Posts: 10
Joined: Wed Feb 04, 2009 11:54 pm

Re: html code entered into a form showing up strange in table

Post by phpstudent »

i disabled them in htaccess and that worked perfectly

thanks for your help, i really appreciate it
Post Reply