Page 1 of 1

text input and strings with double quotes

Posted: Sun Dec 28, 2003 10:43 am
by Bill H
I've done several searches but I'm getting nowhere with this problem. Consider that the user enters the following into a text input in a form:
Person was 6'3" tall, brown eyes, etc.

I have no problem getting that into the database. The problem I have is when the record is called up for review and I attempt to display that string in the text input. The entire string is in the database and in the variable, but all that displays is:
Person was 6'3
This is not a database or PHP question. I have no problems with that part. The question is how do I display in a text input box a string containing a double quote character?

Posted: Sun Dec 28, 2003 10:55 am
by volka
try htmlentitites()

Code: Select all

<?php
$raw = 'ab"<>cd';
$encoded = htmlentities($raw);

echo $encoded;
?>
or (without php) in this case
" -> "

Posted: Sun Dec 28, 2003 7:17 pm
by Bill H
Yep, perfect. Thank you.
I knew the gurus on this forum would come up with a tidy answer.
:D

Posted: Mon Dec 29, 2003 6:12 pm
by thomasd1
you really don't have to be a guru for that :roll:

Posted: Mon Dec 29, 2003 6:47 pm
by Bill H
Didn't say the answer required a guru, merely that the gurus would have it.