|
La Communauté Webmaster 
| Pages: [1] 2 |
 |
|
|
|
Auteur |
Sujet: [Résolu]Récuperer les données d'un formulaire (Lu 2775 fois) |
|
 |
[Résolu]Récuperer les données d'un formulaire
« sur: le 23-10-2008 a 15:29:30 » |
|
|
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #1 sur: le 27-10-2008 a 12:48:09 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #2 sur: le 27-10-2008 a 13:34:50 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #3 sur: le 27-10-2008 a 14:00:12 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #4 sur: le 27-10-2008 a 14:33:31 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #5 sur: le 27-10-2008 a 15:24:32 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #6 sur: le 27-10-2008 a 15:29:34 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #7 sur: le 27-10-2008 a 15:34:19 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #8 sur: le 27-10-2008 a 16:32:40 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #9 sur: le 27-10-2008 a 23:50:45 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #10 sur: le 28-10-2008 a 09:26:54 » |
|
emarie3680
Membre récent

Hors-Ligne
Messages: 16

Je suis un lama!
|
Bon, je jette l'éponge, je n'y arrive pas. Si vous voulez m'aider, vous trouverez mon fichier htm ci-dessous. Le but du jeu est de récupérer ce que les gens saisissent en ligne et que ça me soit renvoyé à mon adresse mail (emarie3680@yahoo.fr).
<html> <head> <title>Questionnaire</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> <!-- function MM_findObj(n, d) { //v4.0 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 && document.getElementById) x=document.getElementById(n); return x; }
function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> </head>
<body bgcolor="#FFCC66" text="#000000"> <p> </p> <table width="75%" border="1"> <tr> <td bordercolor="#3333CC" height="47"> <div align="center"><font size="+2"><b>FAIS-TOI CONNAITRE !</b></font></div> </td> </tr> </table> <form action="Traitemenquest.php" method="post"> <p>Tu es : </p> <table width="23%" border="0"> <tr> <td width="12%"> <input type="radio" name="fille" value="fille"> </td> <td width="36%">Fille</td> <td width="15%"> <input type="radio" name="garcon" value="garcon"> </td> <td width="37%">Garçon</td> </tr> </table> <p>Tu as : <input type="text" name="Age" size="8"> ans</p> <p>Tu es :</p> <table width="85%" border="0"> <tr> <td width="3%"> <input type="radio" name="collegien" value="collegien"> </td> <td width="11%">Collégien</td> <td width="4%"> </td> <td width="5%"> <input type="radio" name="lyceen" value="lyceen"> </td> <td width="8%">Lycéen</td> <td width="5%"> </td> <td width="4%"> <input type="radio" name="etudiant" value="etudiant"> </td> <td width="8%">Étudiant</td> <td width="4%"> </td> <td width="4%"> <input type="radio" name="formation" value="formation"> </td> <td width="44%">En formation</td> </tr> <tr> <td width="3%"> <input type="radio" name="demploi" value="demploi"> </td> <td width="11%">Demandeur d'emploi</td> <td width="4%"> </td> <td width="5%"> <input type="radio" name="salarie" value="salarie"> </td> <td width="8%">Salarié</td> <td width="5%"> </td> <td colspan="5"> Autres Préciser : <input type="text" name="SituationAutre"> </td> </tr> </table> <p>Quelle est ta ville ? : <input type="text" name="Ville"> </p> <p>Comment te déplaces-tu ? : <input type="text" name="deplacement"> </p> <p>Quels sont tes centres d'intérêt ? <input type="text" name="centresinteret"> </p> <p>Merci de nous laisser tes coordonnées :</p> <table width="38%" border="0"> <tr> <td>Nom :</td> <td> <input type="text" name="Nom"> </td> </tr> <tr> <td>Prénom :</td> <td> <input type="text" name="Prenom"> </td> </tr> <tr> <td>Tél.</td> <td> <input type="text" name="Tel"> </td> </tr> <tr> <td>Mail :</td> <td> <input type="text" name="Mail"> </td> </tr> </table> <p>-------------------------------------------------------------------------------------------------------------------------------------------------------</p> <p> <input type="submit" name="Submit" value="Envoyer" onClick="MM_validateForm('textfield','','R','textfield2','','R','textfield3','','R');return document.MM_returnValue"> <input type="reset" name="Submit2" value="Rétablir"> </p> </form> <p> </p> </body> </html>
|
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #11 sur: le 28-10-2008 a 10:45:18 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #12 sur: le 28-10-2008 a 10:57:49 » |
|
|
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #13 sur: le 28-10-2008 a 19:24:07 » |
|
D.F
Membre récent

Hors-Ligne
Messages: 18

|
Re,
Désolé pour le retard pas dispo avant, voici le traitement php simplet comme vous le vouliez. Pour commencer j'ai corrigé votre fichier html , copier coller le et nommer le questionnaire.html, tout simplement parce que j'ai mis une redirection dans le fichier php
<head> <title>Questionnaire</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> <!-- function MM_findObj(n, d) { //v4.0 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 && document.getElementById) x=document.getElementById(n); return x; }
function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> </head>
<body bgcolor="#FFCC66" text="#000000"> <p> </p> <table width="75%" border="1"> <tr> <td bordercolor="#3333CC" height="47"> <div align="center"><font size="+2"><b>FAIS-TOI CONNAITRE !</b></font></div> </td> </tr> </table> <form action="traitement.php" method="post"> <p>Tu es : </p> <table width="23%" border="0"> <tr> <td width="12%"> <input type="radio" name="sexe" value="fille" /> </td> <td width="36%">Fille</td> <td width="15%"> <input type="radio" name="sexe" value="garcon" /> </td> <td width="37%">Garcon</td> </tr> </table> <p>Tu as : <input type="text" name="age" size="8" value=""> ans</p> <p>Tu es :</p> <table width="85%" border="0"> <tr> <td width="3%"> <input type="radio" name="situation" value="collegien"> </td> <td width="11%">Collégien</td> <td width="4%"> </td> <td width="5%"> <input type="radio" name="situation" value="lyceen"> </td> <td width="8%">Lycéen</td> <td width="5%"> </td> <td width="4%"> <input type="radio" name="situation" value="etudiant"> </td> <td width="8%">Étudiant</td> <td width="4%"> </td> <td width="4%"> <input type="radio" name="situation" value="formation"> </td> <td width="44%">En formation</td> </tr> <tr> <td width="3%"> <input type="radio" name="situation" value="demploi"> </td> <td width="11%">Demandeur d'emploi</td> <td width="4%"> </td> <td width="5%"> <input type="radio" name="situation" value="salarie"> </td> <td width="8%">Salarié</td> <td width="5%"> </td> <td colspan="5"> Autres Préciser : <input type="text" name="situationautre" value=""> </td> </tr> </table> <p>Quelle est ta ville ? : <input type="text" name="ville" value=""> </p> <p>Comment te déplaces-tu ? : <input type="text" name="deplacement" value=""> </p> <p>Quels sont tes centres d'intérêt ? <input type="text" name="centresinteret" value=""> </p> <p>Merci de nous laisser tes coordonnées :</p> <table width="38%" border="0"> <tr> <td>Nom :</td> <td> <input type="text" name="nom" value=""> </td> </tr> <tr> <td>Prénom :</td> <td> <input type="text" name="prenom" value=""> </td> </tr> <tr> <td>Tél.</td> <td> <input type="text" name="tel" value=""> </td> </tr> <tr> <td>Mail :</td> <td> <input type="text" name="mail" value=""> </td> </tr> </table> <p>-------------------------------------------------------------------------------------------------------------------------------------------------------</p> <p> <input type="submit" name="Submit" value="envoyer" onClick="MM_validateForm('textfield','','R','textfield2','','R','textfield3','','R');return document.MM_returnValue"> <input type="reset" name="Submit2" value="Rétablir"> </p> </form> <p> </p> </body> </html>
|
|
Ensuite pour le fichier php vous devez mettre votre adresse email dans la variable $mon_email="mon_email" puis idem copier/coller et nommer le traitement.php; Voila si probleme n'hésitez pas, bon courage et bonne soirée.
<?php
// Récupération des varaiables du questionnaire $sexe = $_POST['sexe']; $age = $_POST['age']; $situation = $_POST['situation']; $situationautre = $_POST['situationautre']; $ville = $_POST['ville']; $deplacement = $_POST['deplacement']; $centresinteret = $_POST['centresinteret']; $nom = $_POST['nom']; $prenom = $_POST['prenom']; $tel = $_POST['tel']; $mail = $_POST['mail'];
// Definition de l'email pour la reception du questionnaire $mon_email = "mon_email"; $sujet = "Une personne vient de remplir le formulaire";
$headers = 'FROM: faistoiconnaitre@...'."\r\n"; $headers .='Content-Type: text/html; charset="iso-8859-1"';
// Definition du message comportant les données saisies par l'utilisteur
$message = "Sexe: $sexe<br>Age: $age ans<br>situation: $situation<br> Autres: $situationautre<br><br>"."\n\n"; $message .= "Ville: $ville<br>Deplacement: $deplacement<br>Centre d'intérêt: $centresinteret<br><br>"."\n\n"; $message .= "Nom: $nom<br>Prenom: $prenom<br>Tel: $tel<br>Mail: <a href=mailto:$mail>$mail</a>";
// Envoi du mail $envoi = mail($mon_email, $sujet, $message, $headers);
if ($envoi)
// Si le mail est bien envoyé on affiche un message de remerciement { echo '<center><div style="background:#E6E6FA; width:700px; border:1px solid blue; margin-top:150px; font-family: arial"> <p align="center" style="color:#191970; margin-top: 20px; margin-bottom: 20px; font-size: 120%"><b>Merci d\'avoir pris le temps de remplir le questionnaire </b><br><br> <font face= "arial" color="black" size="3"> Vos données saisies viennent d\'être envoyées au webmaster.</font></p> </div></center>'; }
// Si non on avertit et on redirige automatiquement sur le questionnaire
else { die ("<center><div align ='center' style='background:white; width:650px; border:3px solid #DC143C; margin-top:150px; font-family: arial'> <p align='center' style='color:#990000; margin-top: 20px; margin-bottom: 20px;'>Désolé une erreur est survenue lors de l'envoi du questionnaire, dans 5 secondes <br>vous allez être rediriger sur le site, merci de recommencer</p> </div></center><meta http-equiv='refresh' content='8; url=questionnaire.html'>"); }
?>] |
|
|
David
MARKETING INTERNET - Tout ce que jamais personne ne vous a dit à propos de la vente par internet
ADWORDS - Comment dominer votre marché sur Adwords |
|
|
 |
Re:Cherche script recuperer donnees formulaire
« Répondre #14 sur: le 28-10-2008 a 21:12:01 » |
|
|
|
|
| Pages:
[1] 2 |
|
|
|
| |
|
|