Re: How to escape apostrophe in HTML textbox exactly???

From: Date: Wed, 30 Jun 2004 17:32:29 +0000
Subject: Re: How to escape apostrophe in HTML textbox exactly???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-189317@lists.php.net to get a copy of this message
use " to display the data in the input-text element and undo this before inserting it into the database function quoteToHtml ( $string ) { return str_replace( '"' , '"' , $string ); } function htmlToQuote ( $string ) { return str_replace( '"' , '"' , $string ); } Only way to go :-) Scott Fletcher wrote:
I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to HTML textbox. The only trouble I have is to escape the apostrophe character when it is put into the HTML textbox by PHP (from MySQL). --snip-- echo "<input type='textbox' value='".$value."'>"; --snip-- I can't use the HTML feature like &quot or something because the "&quot" would show up in the database... Any suggestion or advice? Thanks, Scott F.


« previous php.general (#189317) next »