Re: Undefined constant error

From: Date: Mon, 30 Sep 2002 00:21:43 +0000
Subject: Re: Undefined constant error
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-118134@lists.php.net to get a copy of this message
> make sure you have register_globals on in php.ini or your next question > will be 'why isn't $compteur set to the value posted?' Better would be to > change the line to the new magic globals, and learn the right way from > scratch: I agree with you as far, as to learn the right way from scratch - but this is no POST-Var here. > echo "<input type='radio' name='interet' > value='$animalType'"; > if ($_POST['compteur'] == 1) { > echo "checked"; > } > echo ">"; This is another bug in the script. Considering that, it would be correctly: (Note the space between '"' and 'checked') echo "<input type='radio' name='interet' value='$animalType'"; if ($compteur == 1) { echo " checked"; } echo ">"; or shorter: echo "<input type='radio' name='interet' value='$animalType'". ($compteur == 1 ? ' checked' : '') . ">"; Regards Sascha

« previous php.general (#118134) next »