bonjour a tous
voila le souci :
je crée un formulaire avec divers renseignement du style :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans nom</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="test.php">
<table cellspacing=4>
<tr>
<td>nom</TD<td><input type="text" name="nom"></td>
</tr>
<tr>
<td>couleurs</td>
<td>
<select name="coul[]" MULTIPLE>
<option value="rouge">rouge</option>
<option value="jaune">jaune</option>
<option value="vert">vert</option>
</select>
</td>
</tr>
<tr>
<td>sports</td>
<td>
tennis <input type="checkbox" value="tennis" name="sport[]"> -
foot <input type="checkbox" value="foot" name="sport[]"> -
golf <input type="checkbox" value="golf" name="sport[]">
</td>
</tr>
</table>
<br>
<input type=submit value="envoyer">
</form>
</body>
</html>
--------------------------------------------
et mon fichier test.php est le suivant :
---------------------------------------------
<head>
<title>Document sans nom</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
print "nom : $nom<br>";
foreach ($coul as $val)
{
print "couleur : " . $val . "<br>";
}
foreach ($sport as $val)
{
print "sport : " . $val . "<br>";
}
?>
</body>
</html>
BUT..... au lieu d'avoir ceci (exemple selon les choix coché bien sur ):
nom : xxx
couleur : xxx
sport : xxx
sport : xxx
ca me donne :
Notice: Undefined variable: nom in c:\program files\easyphp1-8\www\nouveau dossier\envoiphp\envoiphp3\test.php on line 13
nom :
Warning: Invalid argument supplied for foreach() in c:\program files\easyphp1-8\www\nouveau dossier\envoiphp\envoiphp3\test.php on line 14
Warning: Invalid argument supplied for foreach() in c:\program files\easyphp1-8\www\nouveau dossier\envoiphp\envoiphp3\test.php on line 18
ca fait un petit moment que je me demande bien pourquoi, cela dit je debute et donc j'experimente... ;)
bien sur tout cela est testé en local avec easyphp 1.7
Merci de vos reponse :)
un bon week end