RE: [PHP] Strings in text fields are bad

From: Date: Tue, 26 Sep 2000 04:27:17 +0000
Subject: RE: [PHP] Strings in text fields are bad
Groups: php.general 
Request: Send a blank email to php-general+get-17519@lists.php.net to get a copy of this message
well, just tested: $caddress = "12345 'Abc Ave."; echo '<input type=text name=caddress value="' . $caddress . '">'; not much happens ... -----Original Message----- From: Simon Edwards [mailto:simon@animated.net.au] Sent: Tuesday, September 26, 2000 1:13 PM To: Maxim Maletsky Cc: php-general@lists.php.net Subject: Re: [PHP] Strings in text fields are bad Maxim Maletsky wrote: > Stop, Stop, Stop Guys ... > Why not to teach this guy doing it simplier: > > $caddress = '12345 Abc Ave.'; > echo '<input type=text name=caddress value="' . $caddress . > '">'; Also now would be a good time to explain why wrapping htmlspecialchars() around the variables in the echo statement are a good idea if you want to avoid a nasty surprise in the future. (what happens to the HTML when $caddress contains a string with a ' in it?) Is it just me who is paranoid about these encoding issues? -- Simon Edwards Animated Design, Melbourne http://www.animated.net.au/ Ph: (03) 98850990

« previous php.general (#17519) next »