RE: [PHP] OT? passing text variables through html forms.

From: Date: Thu, 29 Jun 2000 12:08:40 +0000
Subject: RE: [PHP] OT? passing text variables through html forms.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3776@lists.php.net to get a copy of this message
Thing is its the browser parsing the variables in the form and exiting on the second ' or ". It would be the ' or " that would probably have to be replaced with &quot; or &acute; I can't remember what the one for ' is ! Jerry I-D Media Try: <?php $var = "This is 'a' test"; echo "<input type=\"hidden\" name=\"name\" value=\"$var\">\n"; ?> ----- Original Message ----- From: Travis Ruthenburg <listboi@wacko.trickster.net> To: PHP-General Mailing List <php-general@lists.php.net> Sent: Thursday, June 29, 2000 12:50 PM Subject: [PHP] OT? passing text variables through html forms. > Hey there Web Gurus, > > I'm having a little trouble with inserting getting my text into a postgres > database. I'm working on a message-board program in which users must > preview their messages. I'm passing the information through the preview > page using hidden inputs. > > My problem is that single quotes (apostrophe's) aren't being excaped > properly in the html. I wrote my html with single quotes, example: > > > <? > $var = "This is 'a' test"; > <input type='hidden' name='name' value='$var'> > ?> > > This comes out in the html is something like: > > <input type='hidden' name='name' value='This is 'a' > test'> > 1^ 2^ > > The problem is that, as far as the html is concerned, the value ends at > the second quote. > > I know many people do similiar things, so I'm sure I'm simply missing some > fairly obvious solution. Any help would be much appreciated. > > Thanks, > > Travis Ruthenburg > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#3776) next »