Envoie d'un formulaire

Résolu
gain -  
 gain -
Bonjour,

j'ai un formulaire sur lequel une image est affichée. Cependant lorsque l'on clique sur cette image celà agit comme le bouton envoyer et envoie le formulaire. Pour empêcher celà est-ce que je dois ajouter une fonction qui empêche l'envoie du formulaire si un champ est vide(j'aime moins cette idée par rapport aux visiteur qui s'attende à voir un agrandissement) ou est-ce qu'il existe une fonction ou quelque chose que je pourrais ajouter à la photo pour empecher le lien de se faire. Je suis dsl si c'est stupide mais je ne sais pas.

Merci,

<form style="margin-left: 455px; margin-top: 250px;" form method="POST" action="formmail.php">
<font color="white"><big><b>C</b>ommande</big></font><big></big>
<table style="font-family: Tw Cen MT; font-size: 1.2em; color: black;" border="0"><br>
<tbody>
<tr>
<td><span style="font-weight: bold;">P</span>roduit</td>
<td> <input style="border-style: inset; border-width: 3px; width: 75px; height:100px;" name="name" type="image"src="images/img_024.jpg"></td>
<td><span style="font-weight: bold;"></td>
<td> <input style="border-style: inset; border-width: 3px; width: 51px; visibility: hidden;" name="BA_024" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">N</span>om</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="nom" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">P</span>rénom</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="prenom" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">A</span>dresse</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="Adresse" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">V</span>ille</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="Ville" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">P</span>rovince</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="Province" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">C</span>ode <span style="font-weight: bold;">P</span>ostal</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="Code Postal" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">C</span>ourriel</td>
<td> <input style="border-style: inset; border-width: 3px; width: 190px;" name="Courriel" type="text"> </td>
</tr>
<tr>
<td><span style="font-weight: bold;">C</span>ommentaires</td>
<td> <textarea style="border-style: inset; border-width: 3px; width: 190px;height:109px;" rows="6" name="commentaires"> </textarea> </td>
</tr>
<tr>
<td style="text-align: center;" colspan="2"> <input style="border: 2px outset white; font-family: Tw Cen MT; font-size: 1.2em; background-color: rgb(55, 55, 55); color: white; font-weight: bold; width: 220px; text-align: center;" value="Envoyer" type="submit"> </td>
</tr>
</tbody>
</table>
</form>


2 réponses

magicshark Messages postés 445 Statut Membre 13
 
je suis pas sur d'avoir bien compris en faite tu veux utiliser une image au lieu d'un bouton envoyer ? une foi envoyer dans ton form tu dois avoir action="...." redirige vers cette page et test toute tes variable avec isset et SI toutes tes variable sont defini alors tu fais ton traitement sinon tu remet ton formulaire et tu pourrai meme le préreremplir avec des conditionnel IF(ISSET(...){echo" value=' ....';}
0
avion-f16 Messages postés 20367 Statut Contributeur 4 509
 
Salut.

Tu parles pour cette image ?
<input style="border-style: inset; border-width: 3px; width: 75px; height:100px;" name="name" type="image"src="images/img_024.jpg">


Les <input type="image" ... /> au automatiquement la même fonction qu'un input type="submit".

Si tu veux simplement afficher l'image, pourquoi ne pas utiliser <img /> ?
0
gain
 
D'abord merci je ne savais pas que ca prenait la meme valeur qu'un submit.
Effectivement j'ai utilisé <img/> (j'avais pas pensé ! :S)
Merci beaucoup!
0