8796 sujets

Développement web côté serveur, CMS

j'ai créer un bouton dans un fichier php comme ceci :

   
<form action="panier.php" method="post">

 <table frame="void" rules="cols" bordercolor="#666666" cellpadding="5">
  <tr>
   <td><?php echo $data['libelle']; ?></td>
   <td><?php echo $data2['libelle']; ?></td>
   <td><?php echo $data3['libelle']; ?></td>
  </tr>

  <tr>
   <td>
<br/>
<img src="images/vodka/vodka_Donskaia.png"  height="180"/>
<br/><br/>&nbsp;&nbsp;&nbsp;<?php echo $data['prix_ttc']; ?>&euro;
<br/><br/>
<a href="panier.php?action=ajout&amp;l=<?php echo $data['libelle']; ?>&amp;q=1&amp;p=<?php echo $data['prix_ttc']; ?>" /> 
<input type="button" name="formule" value="Ajouter au panier"/>
</td>

  <td>
<img src="images/vodka/vodka_Dworakoff.png" width="160" height="190"/>
<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $data2['prix_ttc']; ?>&euro;<br/><br/>
<a href="panier.php?action=ajout&amp;l=<?php echo $data2['libelle']; ?>&amp;q=1&amp;p=<?php echo $data2['prix_ttc']; ?>" /> 
<input type="button" name="formule" value="Ajouter au panier"/>
</td>

   <td>
<img src="images/vodka/sobieski.png" height="190" />
<br/><br/>&nbsp;&nbsp;&nbsp;<?php echo $data3['prix_ttc']; ?>&euro;
<br/><br/>
<a href="panier.php?action=ajout&amp;l=<?php echo $data3['libelle']; ?>&amp;q=1&amp;p=<?php echo $data3['prix_ttc']; ?>" /> 
<input type="button" name="formule" value="Ajouter au panier"/>
</td>
  </tr>
 </table>
</form>


le bouton fonctionne avec mozilla mais avec ie lorsque j'appuie sur le bouton il ne ce passe rien Smiley confus
Modifié par volcomboy62 (17 Feb 2011 - 16:45)
salut

<input type="button" name="formule" value="Ajouter au panier"/>


se transforme en :

<button type="submit" name="formule">Ajouter au panier</button>


et...çà marche Smiley cligne
salut

Déjà, il y à des problèmes de conception. Pourquoi les liens avec paramètres get et form en post? De plus les liens en get ils ne servent, en l'état à rien. Perso, je ferait :

<a href="panier.php?action=ajout&amp;l=<?php echo $data['libelle']; ?>&amp;q=1&amp;p=<?php echo $data['prix_ttc']; ?>">ajouter au panier</a> 


en supprimant le form et en placant uniquement les liens et images. Après dans panier.php tu récupère en utilisant les superglobales $_GET['l'], etc. et ta variable ajout n'à pas de valeur donc, elle ne sert à rien.