Undefined constant error
| From: | Voisine | Date: | Sun, 29 Sep 2002 23:52:31 +0000 |
| Subject: | Undefined constant error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-118130@lists.php.net to get a copy of this message | ||
Hello,
I'm learning PHP from a book "PHP for newbie writen in French" and I
have an error on one of the exemple. Undifined constant 'compteur' on
line 15 which is :
if (compteur == 1) {
What I'm doing wrong? This is the script
<?php
include("config.inc.php");
$query = "SELECT * FROM Type ORDER BY animalType";
$result = mysql_query($query) or die ("Exécution de la sélection
impossible");
echo "<h1 align='center'>Catalogue</h1><p><h3>Quel type
d'animal
cherchez-vous ?</h3>\n";
echo "<form action='montre_animaux.php' method='post'>\n";
echo "<table cellpadding='5' border='1'>";
$compteur = 1;
while ($ligne = mysql_fetch_array($result)) {
extract($ligne);
echo "<tr><td valign='top' width='15%'>";
echo "<input type='radio' name='interet'
value='$animalType'>";
if (compteur == 1) {
echo "checked";
}
echo "<font
size='+1'><b>$animalType</b></font></td><td>$typeDescription</td></tr>";
$compteur++;
}
echo "</table>";
echo "<p><input type='submit' name='submit' value='Faites
votre
choix'></form>";
?>