Re: Repopulating forms

From: Date: Tue, 05 Aug 2003 14:07:03 +0000
Subject: Re: Repopulating forms
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-158291@lists.php.net to get a copy of this message
From: "Gerard L Petersen" <gerard@gamelink.co.za> > My code looks like this. > > <?PHP > $test = "gerard's name is \"gerard\""; > echo $test."<br>"; > echo '<input type="text" name="test2" > value="'.$test.'"><br>'; > ?> Just like HTML doesn't render newlines, it also doesn't understand using the \ character as an escape character. You are creating this: <input type="text" name="test2" value="gerard's name is "gerard""> So, HTML takes the first bit between double quotes and ignores the rest as a unknown attribute. Run htmlentities() on $test before putting it in the INPUT element to change the quotes to HTML entities. ---John Holmes...

« previous php.general (#158291) next »