On Wed, 30 Jun 2004 19:32:29 +0200, Red Wingate <[EMAIL PROTECTED]> wrote:
> 
> use &quot; to display the data in the input-text element and undo this
> before inserting it into the database
> 
> function quoteToHtml ( $string ) {
>    return str_replace( '"' , '&quot;' , $string );
> }

Much better to use htmlentities(), it will get all quotes and other
special chars (<, >, etc) which can cause problems.

> function htmlToQuote ( $string ) {
>    return str_replace( '&quot;' , '"' , $string );
> }
> 

You don't need to do this. When the browser submits the request, it
will come through $_REQUEST as a quote, not as an HTML entity.

> 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.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> !DSPAM:40e2f52755689422721120!
> 
> 


-- 
paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to