RE: [PHP] Trouble with using isset and form posting

From: Date: Thu, 13 May 2004 13:26:56 +0000
Subject: RE: [PHP] Trouble with using isset and form posting
Groups: php.general 
Request: Send a blank email to php-general+get-186094@lists.php.net to get a copy of this message
[snip] A simplified version of the code is shown below and is posting to itself. Any idea what I'm doing wrong? <?PHP if(!isset($_GET['realname'])) { $realname = 'Your Name'; } ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form name="form1" method="post" action="testform.php"> Please Enter <input name="guest1" type="text" value="<?php print $realname; ?>"> <input type="submit" name="Submit" value="Submit"> </form> </body> </html> [/snip] I tried this (navigated directly to the page) and it worked. You probably want to set the GET array thingie though...like this <?php if(!isset($_GET['realname'])) { $_GET['realname'] = 'Your Name'; } ?> And use <input name="guest1" type="text" value="<?php print $_GET['realname']; ?>"> so that the realname value gets outputted no matter what

« previous php.general (#186094) next »