Page 1 sur 1

Probleme formulaire

Posté : 31 mars 2009, 00:01
par cyril1506
bonsoir a tous,
donc voila j'ai un formulaire et quand je valide, ca me prend juste la derniere ligne :s:s:s

voila mon code :

Code : Tout sélectionner

<form action='Enregistrement_Cmd.php' method='POST'> <h3>Formulaire de commande :</h3> <h5><em>Saisir les r&eacute;f&eacute;rences meubles du catalogue et la quantit&eacute; souhait&eacute;e</em></h5> <table width="304" border="1"> <tr> <th width="144" scope="col">R&eacute;f&eacute;rence</th> <th width="144" scope="col">Quantit&eacute;</th> </tr> <tr> <td><input type="text"name="Reference"></td> <td><input type="text"name="Quantite"></td> </tr> <tr> <td><input type="text"name="Reference"></td> <td><input type="text"name="Quantite"></td> </tr> </table><input type="submit" value="Valider" /> </form>
merci de vos reponse

Posté : 31 mars 2009, 00:39
par Kemper
Normal, tes champs texte ont le même nom (2 par 2) donc à l'arrivée, une seule variable, une seule valeur, une seule ligne.

Fais en sorte de récupérer un tableau :
<pre>
<?php print_r($_POST); ?>
</pre>


<form action='Enregistrement_Cmd.php' method='POST'>
<h3>Formulaire de commande :</h3>
<h5><em>Saisir les r&eacute;f&eacute;rences meubles du catalogue et la quantit&eacute; souhait&eacute;e</em></h5>
<table width="304" border="1">
  <tr>
    <th width="144" scope="col">R&eacute;f&eacute;rence</th>
    <th width="144" scope="col">Quantit&eacute;</th>
  </tr>
  <tr>
    <td><input type="text"name="Reference[]"></td>
    <td><input type="text"name="Quantite[]"></td>
  </tr>
  <tr>
    <td><input type="text"name="Reference[]"></td>
    <td><input type="text"name="Quantite[]"></td>
  </tr>
     </table><input type="submit" value="Valider" />
    </form>

Posté : 31 mars 2009, 10:54
par cyril1506
et dans enregistrement_cmd.php comment je les recupere ?

Posté : 31 mars 2009, 11:41
par Elie
$_POST['Reference'] = array(0 => 'Ton premier truc', 1 => 'Ton deuxieme truc');
$_POST['Reference'][1] = 'Ton deuxieme truc';