Passer variable POST d'une région répétée à une autre page

Petit nouveau ! | 7 Messages

09 juin 2011, 11:57

Salut,

J'ai un problème que je n'arrive pas à régler et je n'ai pas encore trouvé de solution sur la toile.

J'ai créé une région répétée avec plusieurs champs, dont un champ "Id" et un bouton "Submit"

Zone répétée
----------------------------------------------------------------------------
{r_lst_callprog.id}, {r_lst_callprog.nameprog} | etc. | SUBMIT |
----------------------------------------------------------------------------

Les records apparaissent bien les uns sous les autres avec leur bouton submit, mais lorsque j'essaie de faire passer la variable "id" par le bouton (en POST) cela ne fonctionne pas. Je m'explique si je choisi le record 5 avec l'Id 5, je veux qu'il me passe la variable Id "5" sur une autre page.

J'ai bien sûr réussi à faire passer la variable en GET par href, mais je souhaite impérativement la faire passer en POST.

J'ai créé un champ hidden (voir ci-dessous) qui devrait (mais cela ne fonctionne pas) récupérer l'id et la passer par submit à l'autre page.

Merci d'avance pour vos suggestions, car cela fait plusieurs jours que je n'arrive pas à régler ce problème.

Marc
      <input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callprog['id']; ?>" />
      <input name="submit" type="submit" id="submit" class="submit" value="" />
Code de la région répétée

Code : Tout sélectionner

<td class="fieldtitle_2">#</td> <td class="fieldtitle_2">Titre<br /> de l'appel</td> <td class="fieldtitle_2">Date<br /> de création</td> <td class="fieldtitle_2" colspan="2">Durée de la campagne<br /> du / au</td> <td class="fieldtitle_2" colspan="2">Durée du programme<br /> du / au</td> <td class="fieldtitle_2">Besoins<br /> financiers</td> <td class="fieldtitle_2">Voir<br /> détails</td> </tr> <form action="index.php?option=com_jumi&fileid=20&Itemid=560" method="post" name="view" id="view"> <?php do { ?> <tr> <td class="fieldcontent"><?php echo $row_r_lst_callprog['id']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['nameprog']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['creation']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['datestartcamp']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['dateendcamp']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['datestartprog']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['dateendprog']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['financialneeds']; ?></td> <td class="fieldcontent"> <input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callprog['id']; ?>" /> <input name="submit" type="submit" id="submit" class="submit" value="" /> <input name="MM_insert" type="hidden" id="MM_insert" value="view" /> </td> </tr> <?php } while ($row_r_lst_callprog = mysql_fetch_assoc($r_lst_callprog)); ?> </form>
Modifié en dernier par billledouble le 09 juin 2011, 12:35, modifié 1 fois.

ViPHP
ViPHP | 2577 Messages

09 juin 2011, 12:20

Bonjour,

Il faut que chaque submit soit dans un formulaire différent (avec l'input hidden) ou avoir 1 seul champ input hidden et lui affecter une valeur via javascript dans le bouton submit.

Petit nouveau ! | 7 Messages

09 juin 2011, 12:35

Merci Mazarini,


Ci-après le code de ma région répétée, suis je sur la bonne voie ?

Code : Tout sélectionner

<td class="fieldtitle_2">#</td> <td class="fieldtitle_2">Titre<br /> de l'appel</td> <td class="fieldtitle_2">Date<br /> de création</td> <td class="fieldtitle_2" colspan="2">Durée de la campagne<br /> du / au</td> <td class="fieldtitle_2" colspan="2">Durée du programme<br /> du / au</td> <td class="fieldtitle_2">Besoins<br /> financiers</td> <td class="fieldtitle_2">Voir<br /> détails</td> </tr> <form action="index.php?option=com_jumi&fileid=20&Itemid=560" method="post" name="view" id="view"> <?php do { ?> <tr> <td class="fieldcontent"><?php echo $row_r_lst_callprog['id']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['nameprog']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['creation']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['datestartcamp']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['dateendcamp']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['datestartprog']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['dateendprog']; ?></td> <td class="fieldcontent"><?php echo $row_r_lst_callprog['financialneeds']; ?></td> <td class="fieldcontent"> <input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callprog['id']; ?>" /> <input name="submit" type="submit" id="submit" class="submit" value="" /> <input name="MM_insert" type="hidden" id="MM_insert" value="view" /> </td> </tr> <?php } while ($row_r_lst_callprog = mysql_fetch_assoc($r_lst_callprog)); ?> </form>