Re: Repopulating forms

From: Date: Tue, 05 Aug 2003 14:11:01 +0000
Subject: Re: Repopulating forms
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-158292@lists.php.net to get a copy of this message
Opp... forgot this.... use htmlspecialchars( ) to fix it. It will convert your " to &quot; for you. So you code should look like this: <?PHP $test = htmlspecialchars ("gerard's name is \"gerard\""); echo $test."<br>"; echo '<input type="text" name="test2" value="'.$test.'"><br>'; ?> <form action="test2.php" method="post"> <input type="text" name="foo" value="" /> <input type="submit" name="sub" value="submit"> </form> and it will work :) - Anthony Gerard L Petersen" <gerard@gamelink.co.za> wrote in message news:040201c35b59$3ebce690$050aa8c0@guided1... > Hi > > My code looks like this. > > <?PHP > $test = "gerard's name is \"gerard\""; > echo $test."<br>"; > echo '<input type="text" name="test2" > value="'.$test.'"><br>'; > ?> > > <form action="test2.php" method="post"> > <input type="text" name="foo" value="" /> > <input type="submit" name="sub" value="submit"> > > </form> > > > When i run it the bit after the quotes are truncated. Where it truncates > depends on what type of quote i am using. > > Any ideas? > > Thanks > > Gerard > >

« previous php.general (#158292) next »