Version complète: sur le forum Webmaster Hub : formulaire firefox et IE
Webmaster Hub > Création et exploitation de Sites Internet > Les langages du Net
Mumulafrite
Bonjour,
jai fais un formualire de contact mais il ne marche pas sous IE et fonctionne tres bien sous internet explorer.
Pourriez vous m'aider?

voici le code du traitement de formulaire:
CODE
<?
if(isset($_POST['envoyer'])) {
$select = $_POST['select'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$Email = $_POST['Email'];
$Sujet = $_POST['Sujet'];
$Message = $_POST['message'];
if (empty($Email)) { echo("<span class=\"title2\">Vous n'avez mis votre email !</span><br>"); }
if (empty($prenom)) { echo("<span class=\"title2\">Vous n'avez mis votre prenom ou pseudo!</span><br>"); }
if (empty($message)) { echo("<span class=\"title2\">Vous n'avez mis votre message!</span><br>"); }
if ($Email != "" and $prenom != "" and $message != "")
{
$compil = $nom." ".$prenom." ($select ,pseudo : $pseudo) a écrit : $Message";


mail("mumulafrite_AT_webfolie.com",$Sujet,$compil,"From: ".$Email);
echo("<span class=\"title2\">Votre message a bien été envoyé</span>");
}}
?>


Voici le code des boutons:
CODE
><table width="29%" border="0" cellspacing="0" cellpadding="2">
                                                         <tr>
                                                           <td><input name="envoyer" VALUE="Send" type="image" id="envoyer" src="img/contact/send.gif"></td>
                                                           <td><input type="image"  VALUE="Clear" src="img/contact/reset.gif" name="Reset"></td>
                                                         </tr>
                                                       </table


La page est http://www.webfolie.com/contact.php

Merci d'avance
Dudu
CITATION(Mumulafrite @ dimanche 26 février 2006, 23h28)
il ne marche pas sous IE et fonctionne tres bien sous internet explorer.
C'est balaise blink.gif Joli tour de force biggrin.gif

Plus sérieusement, peux-tu nous fournir plus d'explications ? Qu'est ce qui ne marche pas dans ton formulaire ?
La mise en page (l'HTML) ou l'interprétation (PHP) ?

Car à vue de nez, si on ferme les yeux sur ces horribles tableaux qui n'ont rien à faire là, tout me semble correct... (bien qu'on n'ait pas tout le code sous les yeux)
Mumulafrite
Oups pardon pour l'erreur, cela fonctionne sous firefox mais pas sous IE.

A priori, c'est l'interpretation php qui ne doit pas marcher, quand je clique sur le bouton envoyer (l'image) il recharge la page mais ne fait rien, n'envois pas, ni n'execute les conditions de remplissage.

Je peux vous montrer le code entier pas de problême. Je me demande si cela ne vient pas de ma facon de placer la balise <form>

CODE
<?
include("include/compteur/visite.php");
require("config.php");
require("include/connect_db.php");
require("include/date_fr.php");
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<? include ('include/meta/metaindex.php'); ?>
<link href="style.css" rel="stylesheet" type="text/css">
<title>Contactez l'equipe de webfolie</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//-->
</script>
</head>
<body>
<form method="POST" action="contact.php" enctype="multipart/form-data" name="AVIS">
<table height="317" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="973" height="298"><table width="973" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#B7C5D2" class="tab">
<tr>
<td><? include('include/header.php'); ?></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13" colspan="2"> </td>
</tr>
<tr>
<td width="75%" valign="top"><table width="781" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="762" height="19" background="pic_index/center/ht.gif"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="a_news"><a href="http://www.webfolie.com" class="a_news">Webfolie</a> &gt; Contact
</td>
</tr>
</table></td>
<td width="19"><img src="pic_index/center/coin_ht.gif" width="19" height="19"></td>
</tr>
<tr>
<td background="pic_index/bck_index.gif" bgcolor="EAF0F3">
<table width="100%" height="288" border="0" cellpadding="0" cellspacing="5">

<tr>
<td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11%"><img src="img/contact/contact.gif" width="80" height="74"></td>
<td width="89%" style="padding-left:5px">Vous &ecirc;tes un annonceur, une&nbsp;agence&nbsp;m&eacute;dia&nbsp;et souhaitez annoncer sur Webfolie.com, ou proposer un partenariat. N'hesitez pas a nous contacter gr&acirc;ce&nbsp;au&nbsp;formulaire ci-dessous.<br>
<br>
Vous &ecirc;tes un de nos membres et vous rencontrez des probl&egrave;mes avec notre portail n'h&eacute;sitez pas &agrave; nous contacter en pr&eacute;cisant bien la nature du probl&egrave;me rencontr&eacute;. Nous nous ferons un plaisir d'y trouver une solution.</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td background="img/index/for_title.gif" class="title1">Nous contacter via formulaire </td>
</tr>
</table></td>
</tr>
<tr>
<td width="50%" valign="top">
<!--Fond Orange pour pics et ligne -->
<?
if(isset($_POST['envoyer'])) {
$select = $_POST['select'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$Email = $_POST['Email'];
$Sujet = $_POST['Sujet'];
$Message = $_POST['message'];
if (empty($Email)) { echo("<span class=\"title2\">Vous n'avez mis votre email !</span><br>"); }
if (empty($prenom)) { echo("<span class=\"title2\">Vous n'avez mis votre prenom ou pseudo!</span><br>"); }
if (empty($message)) { echo("<span class=\"title2\">Vous n'avez mis votre message!</span><br>"); }
if ($Email != "" and $prenom != "" and $message != "")
{
$compil = $nom." ".$prenom." ($select ,pseudo : $pseudo) a écrit : $Message";


mail("mumulafrite_AT_webfolie.com",$Sujet,$compil,"From: ".$Email);
echo("<span class=\"title2\">Votre message a bien été envoyé</span>");
}}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="FF6600" background="pic_index/bg_cadre_ff6600.gif">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5"></td>
<td bgcolor="#B7C5D2" class="titlept1">&nbsp;Les
cr&eacute;ateurs : </td>
<td width="5" valign="top" bgcolor="#B7C5D2" class="ss_title1"><img src="img/index/hoek.gif" width="5" height="10"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"></td>
<td bgcolor="#EAF0F3"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="right" valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="29%" align="left" bgcolor="#B7C5D2" class="titlept1">Vous
&ecirc;tes? </td>
<td width="71%" align="left"><select name="select" class="input_contact">
<option value="annonceur">Annonceur</option>
<option value="membre">Membre</option>
</select> </td>
</tr>
<tr>
<td align="left" bgcolor="#B7C5D2" class="titlept1">Nom</td>
<td align="left"><input name="nom" type="text" class="input_contact" id="nom" size="30"></td>
</tr>
<tr>
<td align="left" bgcolor="#B7C5D2" class="titlept1">Pr&eacute;nom/Pseudo*</td>
<td align="left"><input name="prenom" type="text" class="input_contact" id="prenom" size="30"></td>
</tr>
<tr>
<td align="left" bgcolor="#B7C5D2" class="titlept1">Adresse
Email* </td>
<td align="left"><input name="Email" type="text" class="input_contact" id="Email" size="30"></td>
</tr>
<tr>
<td align="left" bgcolor="#B7C5D2" class="titlept1">Sujet</td>
<td align="left"><input name="Sujet" type="text" class="input_contact" id="Sujet" size="30"></td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#B7C5D2" class="titlept1">Message/Questions*</td>
<td align="left"><textarea name="message" cols="30" rows="5" class="input_contact" id="message"></textarea></td>
</tr>
<tr>
<td align="left" valign="top" class="postreply">*champs
obligatoires </td>
<td align="right"><table width="29%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><input name="envoyer" VALUE="Send" type="image" id="envoyer" src="img/contact/send.gif"></td>
<td><input type="image" VALUE="Clear" src="img/contact/reset.gif" name="Reset"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="50%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="FF6600" background="pic_index/bg_cadre_ff6600.gif">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5"></td>
<td bgcolor="#B7C5D2" class="titlept1">&nbsp;Liens
Sponsoris&eacute;s </td>
<td width="5" valign="top" bgcolor="#B7C5D2" class="ss_title1"><img src="img/index/hoek.gif" width="5" height="10"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"></td>
<td bgcolor="#EAF0F3"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td> <div align="center">
<? include('include/pub250x250.php')?>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<br>
<br/> </td>
</tr>
</table></td>
<td width="19" background="pic_index/center/dr.gif">&nbsp;</td>
</tr>
<tr>
<td height="19" background="pic_index/center/bas.gif"></td>
<td width="19"><img src="pic_index/center/coin_bas.gif" width="19" height="19"></td>
</tr>
</table></td>
<td width="20" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><span class="titlept3">Webfolie &gt; </span><span class="titlept2">Accueil</span>
<BR> <img src="img/index/llign_ora.gif" width="180" height="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><? include('include/compteurlive.php'); ?></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><span class="titlept3">Webfolie &gt;</span> <span class="titlept2">Partenaires</span>
<BR> <img src="img/index/llign_ora.gif" width="180" height="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td><? include('include/blocpartenaires.php'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="27" valign="top"><? include('include/fooder.php'); ?></td>
</tr>
</table></td>
<td width="7" background="pic_index/shadow.gif">&nbsp;</td>
</tr>
<tr>
<td height="7" background="pic_index/shadow_dw.gif"></td>
<td valign="top"><img src="pic_index/coin.gif" width="4" height="4"></td>
</tr>
</table>
</form>
</body>
</html>


Pour ce qui est des tableaux bah dsl mais le graphiste refait petit à petit le site en css
Merci
captain_torche
Pour une fois, c'est que Firefox est plus laxiste qu'IE.

Le souci, c'est que tu utilises des boutons de type image, qui ne fonctionnent pas de la même façon qu'un input "normal".

Lorsque tu cliques sur un tel bouton, les coordonnées de ton clic seront renvoyées en POST, de la manière suivante 'envoyer_x' et 'envoyer_y', si ton bouton s'appelle 'envoyer'.

Il faut juste que tu modifies ton code de traitement, de la manière suivante :
CODE
if(isset($_POST['envoyer_x'])) {
// traitement
}
Mumulafrite
merci je vais tester en fin d'après midi.

Mais ce que je comprends pas c'est cette histoire de coordonnée.
A la place de x faut mettre des coordonnées du bouton?

je vais faire le chaint mais tu pourrais m'expliquer un peu plus car j'aime bien comprendre tongue.gif

Merci
captain_torche
Non, c'est juste les variables envoyer_x et envoyer_y, qui contiendront les coordonnées de ton curseur sur l'image au moment du clic.
Si jamais tu cliquais en haut à gauche de l'image, tu obtiendrais comme valeurs de POST :
$_POST['envoyer_x'] = 1;
$_POST['envoyer_y'] = 1;
Mumulafrite
Merci et désolé pour le temps de réponse.

Bon et bien je vais plutot adopté le bouton normal avec un css, ca donnera pas exactement ce que je voulais mais c'est propre quand même.

Merci beaucoup de ton aide
captain_torche
Je ne comprends pas ...
Il n'y a pourtant rien de compliqué ?
Je me suis mal expliqué ?
Mumulafrite
non non mais en fait si je modifie le formulaire ou bien la page, je suis a chaque fois dans l'obligation de retrouver les coordonnées du bouton.

Malgré que je n'utilise pas cette solution, je pense que cela peut servir à quelqu'un.

Ton expliquation est très bonne et jai compris. smile.gif

Merci
captain_torche
Tu n'es pas obligé de vérifier les coordonnées exactes du bouton, mais juste que celles-ci existent.
Tant qu'on n'a pas cliqué sur le bouton, aucune variable n'est envoyée par POST.

Quand on clique sur le bouton, les variables envoyer_x et envoyer_y existent.
On se contrefiche totalement de savoir quelles sont leur valeur (1, 15 ou 734), on contrôle juste leur existence (cf le code de mon premier post).

Sinon, pendant qu'on y est, quelqu'un connaît-il les raisons historiques et/ou techniques de cette manière de récupérer les valeurs ?
Anonymus
CITATION(captain_torche @ mercredi 01 mars 2006, 22h32)
Sinon, pendant qu'on y est, quelqu'un connaît-il les raisons historiques et/ou techniques de cette manière de récupérer les valeurs ?
*

A priori ca sert dans le cas où l'on place plusieurs boutons sur la page !?

(quoique...)

Peut être que le bouton a été créé pour servir aussi à autre chose (coordonnées envoyées par gps ? biggrin.gif )
Ceci est une version "bas débit" de notre forum. Pour voir la version complète avec plus d'information, la mise en page et les images, veuillez cliquer ici.