Re: Quotes, Double Quotes and Hidden Fields

From: Date: Wed, 27 Dec 2000 21:35:39 +0000
Subject: Re: Quotes, Double Quotes and Hidden Fields
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-32012@lists.php.net to get a copy of this message
On Wed, 27 Dec 2000, Gareth Mulholland wrote: > I've created a form which contains about 12 textareas and text inputs. > > If a user inputs a string which contains a number of " and ' characters > then things get messy when the input is displayed for preview and is posted > in hidden fields for final posting. > > I kept finding that data was being lost when input strings contained these > quotes and have resorted to the following: > > $contact_name = htmlentities(stripslashes($contact_name)); > $contact_email = htmlentities(stripslashes($contact_email)); > $contact_add = htmlentities(stripslashes($contact_add)); > $contact_tel = htmlentities(stripslashes($contact_tel)); > $contact_fax = htmlentities(stripslashes($contact_fax)); > $url = htmlentities(stripslashes($url)); > $comments = htmlentities(stripslashes($comments)); > > This seems very clumsy and probably unnecessary - is there a better way of > doing this? > > Thanks > Gareth > For storing in hidden fields I use base64_encode/decode(). Displaying, though, needs htmlentities(). -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#32012) next »