Page 1 of 1

Quoted text disapearing in text input boxes

Posted: Mon Mar 13, 2006 10:03 pm
by clem_c_rock
Hello,

This is rather embarassing given my 4 years of php coding experience but I've noticed when I'm pulling quoted text from a database into a input text field, the entire text w/in the quotes, and the quotes themselves disappears.

For instance, if I try to echo this string: this is "text", only the string: this is will show up in the text input box.

I know there has to something stupid I'm missing

Thanks,
Clem C

Posted: Mon Mar 13, 2006 10:14 pm
by feyd

Re: Quoted text disapearing in text input boxes

Posted: Mon Mar 13, 2006 10:17 pm
by alex.barylski
clem_c_rock wrote:Hello,

This is rather embarassing given my 4 years of php coding experience but I've noticed when I'm pulling quoted text from a database into a input text field, the entire text w/in the quotes, and the quotes themselves disappears.

For instance, if I try to echo this string: this is "text", only the string: this is will show up in the text input box.

I know there has to something stupid I'm missing

Thanks,
Clem C
So, only when you pull text from a database? or when you also echo quoted text?

Code: Select all

echo 'This is some "quoted text"';
Is your text stored in a DB as completely quoted? Single quote or double quotes?

You should provide more details...might be something your doing with addslashes() or failing to do...who knows...

p.s-Why is any question embarrising?

Thats the beauty of computers and programming ...the more you know...the more you realize the less you know... :)

Sorry I couldn't be of more help, but i've never experienced a problem like this...

Cheers :)

Posted: Mon Mar 13, 2006 10:52 pm
by clem_c_rock
Ah - great - the combonation of <?=stripslashes( htmlentities( $var ) ) ?> worked beautifully.

Why haven't I ever used htmlentities()?

Thanks again all

Much obliged!