Re: Help w/ quotes/html and data from MySQL

From: Date: Tue, 23 Jan 2001 22:50:07 +0000
Subject: Re: Help w/ quotes/html and data from MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36283@lists.php.net to get a copy of this message
At 4:47 PM -0500 1/23/01, Shane McBride wrote:
I have a field in MySQL that holds data that may look like this: <b>Rose Painting</b>"Looks really nice, blah, blah"<b>25.00</b> Now, I want to pull that data back into a form <textarea> to edit. Here's how I have unsuccessfully been doing it: ?> .... beginning code <td>Description:</td> <td><textarea name=\"description\" value='$description' cols=\"50\" rows=\"5\"></textarea></td> ...ending code ?> I looks like that the embedded html in the MySQL data is actually being "rendered" (for the lack of a better term). How can I get the whole chunk of data back into the form?
Well, if you're using PHP: echo '<td>Description:</td>', '<td><textarea name="description" cols="50" rows="5">', htmlentities($description), '</textarea></td>' ; Presumably, other web development languages have an equivalent construct to PHP's htmlentities(). Also, the value of a textarea tag is not put in a 'value' attribute within the tag as with the INPUT tag; it is put in the textarea 'container' - that is, between the <textarea> and </textarea> tags. - steve -- +--- "They've got a cherry pie there, that'll kill ya" ------------------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------------------- FBI Special Agent Dale Cooper ---+

« previous php.general (#36283) next »