[Résolu] Formulaire - problème

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [Résolu] Formulaire - problème

Re: Formulaire - problème

par Sheppard92 » 20 avr. 2012, 18:54

Excellent, merci , j'avais pas mis le point.

Re: Formulaire - problème

par Mazarini » 20 avr. 2012, 18:15

$msg .= "Have you played any first person shooting games:\t$played_FPS\n";
doit etre remplacé par :
$msg .= "Have you played any first person shooting games:\t".$_POST['played_FPS']."\n";

PAs de raison que ca ne marche pas.

Re: Formulaire - problème

par Sheppard92 » 20 avr. 2012, 17:58

Salut,

Tu utilise une méthode qui n'a plus court l'auto déclaration des variables.
Comment faire : http://www.lephpfacile.com/cours/8-recu ... ormulaires

@+
<html>
<head>
<title>Ma page de traitement</title>
</head>
<body>
<?  
// on teste la déclaration de nos variables
if (isset($_POST['nom']) && isset($_POST['fonction'])) { 
   // on affiche nos résultats
   echo 'Votre nom est '.$_POST['nom'].' et votre fonction est '.$_POST['fonction'];  
}  
?>
</body>
</html> 
Mais sur ce lien j'ai pas trouvé où mettre mon mail, car j'aimerais le recevoir par mail le formulaire.
@Mazarini j'ai essayé mais ça ne marche pas.

Re: Formulaire - problème

par Mazarini » 20 avr. 2012, 17:24

Remplacer $account_suspended par $_POST['account_suspended']
ou commencer le script par $account_suspended = $_POST['account_suspended']
Ceci pour chaque variable du formulaire.

Re: Formulaire - problème

par Sheppard92 » 20 avr. 2012, 16:10

Merci beaucoup et comment je peux faire en sorte avec cette méthode pour que le formulaire soit envoyé sur mon mail. ?

Re: Formulaire - problème

par moogli » 20 avr. 2012, 15:45

Salut,

Tu utilise une méthode qui n'a plus court l'auto déclaration des variables.
Comment faire : http://www.lephpfacile.com/cours/8-recu ... ormulaires

@+

[Résolu] Formulaire - problème

par Sheppard92 » 20 avr. 2012, 14:43

Bonjour,
Alors je vous explique mon problème,
J'ai voulu faire un formulaire d'inscription pour une team de jeu online, mais une fois le formulaire envoyé, je reçois le mail sauf que dans le mail, j'ai pas les réponse des questionnaire, j'ai par exemple:
Nom:
Année d’inscription:
etc..

Voilà mes deux codes, l'un Html l'autre php.
<FORM method="POST" action="do_sendform.php">

					<div class="form_description">
			<h2>Silver Hawk - Form</h2>
			<p>
Application Requirements:
<br>
1. SL account must be at least 1 months old. (exceptions may be made) <br>
2. You must leave all other armies if you are accepted.<br>
3. You must be able to speak (type) and understand english. <br>
4. All questions must be answered truthfully to the best of your knowledge. Failure to do so will result in ejection regardless of time spent in this military. <br>
5. Your name must be in the title of this notecard (not the description above) otherwise it will be declined by our recruiters.<br>
6. Please note we use a voice service called mumble and encourage its use even just to listen, the link is      http://www.mumble.com<br>

</p>
		</div>						
			<ul >
			
					
		<p>- What is your Second Life name?<br>
		<input name="SL_Name" class="element text medium" type="text" maxlength="255" value=""/> 
		
		<p>- How did you find us? <br>
		<input name="How_did_you_find_us" class="element text large" type="text" maxlength="255" value=""/> 
		
		<p>- What is your primary language?  <br>
		<input name="Primary_language" class="element text medium" type="text" maxlength="255" value=""/> 
		
		<p>- What are your normal hours of activity in SL (If varied just say so)?<br>
		<input name="Hours_of_activity" class="element text large" type="text" maxlength="255" value=""/> 
		
		<p>- Do you have any alts?, if so, please list them below. <br>
	    <input name="Any_Alt" class="element text large" type="text" maxlength="255" value=""/> 
		 
		<p>- Have you been in any other military groups in SL? If so which ones and what ranks or merits did you achieve? <br>
	    <textarea name="Other_military" class="element textarea medium"></textarea> 
		
	
		<p>- What social, political, cultural, etc. skills can you contribute to this army? <br>
		<textarea name="Skills_can_you_contribute" class="element textarea medium"></textarea> 
		
		<p>- Are you older than one month? <br>
		<span>
			<input name="Older_than_month" class="element radio" type="radio" value="1" />
<label class="choice" for="element_12_1">Yes</label>
<input name="Older_than_month" class="element radio" type="radio" value="2" />
<label class="choice" for="element_12_2">Nope, coming back later</label><br>

		</span> 
		<p>- Have you played any first person shooting games? (eg Modern Warfare)<br>
		<span>
			<input name="played_FPS" class="element radio" type="radio" value="1" />
<label class="choice" for="element_13_1">Yes.</label>
<input name="Played_FPS" class="element radio" type="radio" value="2" />
<label class="choice" for="element_13_2">No.</label>

		</span> 
		
		<p>- Were you referred by anyone? <br>
		<span>
			<input name="referred_by_anyone" class="element radio" type="radio" value="1" />
<label class="choice" for="element_14_1">Yes</label>
<input name="referred_by_anyone" class="element radio" type="radio" value="2" />
<label class="choice" for="element_14_2">No</label><br>

		</span> 
	
		<p>- If yes,by ... <br>
		<input name="if_yes_by" class="element text medium" type="text" maxlength="255" value=""/> 
		
		<p>- Has your account ever been suspended by Linden Labs? <br>
		<span>
			<input name="account_suspended" class="element radio" type="radio" value="1" />
<label class="choice" for="element_15_1">Yes.</label>
<input id="element_15_2" name="account_suspended" class="element radio" type="radio" value="2" />
<label class="choice" for="element_15_2">No.</label><br>

		</span> 
		<p>If yes, why... <br>
		<input name="if_yes_why" class="element text medium" type="text" maxlength="255" value=""/> 
		
		<p>- Which is heavier, a kilogram of iron or a kilogram of cotton? <br>
		<input name="iron_or_coton" class="element text medium" type="text" maxlength="255" value=""/> 
		
		</li>		<li class="section_break">
			<h3>In case you have some questions, feel free to contact any officers on the list below. Thank you.

  croc Foxclaw<br> 
  Danthe Constatine <br>
  Fay Franzos<br>
  Sin Straaf<br>
  Mischa Firecaster<br></h3>
			<p></p>
		</li>
			
					<li class="buttons">
			    <input type="hidden" name="form_id" value="390733" />
			    
				<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
		</li>
			</ul>
		</form>	
Pour le formulaire, je l'avais fait d'abord sur un générateur de formulaire.

Ensuite pour le fichier php:
<?php 

$msg .= "Second Life Name:\t$SL_Name\n";
$msg .= "How did you Find us:\t$How_did_you_find_us\n";
$msg .= "What is your primary language:\t$Primary_language\n";
$msg .= "What are your normal hours of activity in SL:\t$Hours_of_activity\n";
$msg .= "Do you have any alts:\t$Any_alt\n";
$msg .= "Have you been in any other military groups in SL:\t$Other_military\n";
$msg .= "What social political, cultural etc skills can you contribute to this army:\t$Skills_can_you_contribute\n";
$msg .= "Are you older than one month:\t$Older_than_month\n";
$msg .= "Have you played any first person shooting games:\t$played_FPS\n";
$msg .= "Were you referred by anyone:\t$referred_by_anyone\n";
$msg .= "If yes by:\t$if_yes_by\n";
$msg .= "Has your account ever been suspended by Linden Labs:\t$account_suspended\n";
$msg .= "If yes Why:\t$if_yes_why\n";
$msg .= "Which is heavier a kilogram of iron or a kilogram of cotton:\t$iron_or_coton\n\n";

$recipient = "[email protected]";
$subject = "Silver Hawk Application";

$mailheaders = "From: Silver Hawk Army <> \n";
$mailheaders .= "Reply-To: $sender_email\n\n";

mail($recipient, $subject, $msg, $mailheaders);

echo "<HTML><HEAD>";
echo "<TITLE>Form Sent!</TITLE></HEAD><BODY>";
echo "<H1 align=center>Thank You, $sender_name</H1>";
echo "<P align=center>";
echo "Your form has been sent.</P>";
echo "</BODY></HTML>";

?>
Donc voilà, j'espère avoir été compréhensible, ce que je cherche avant tout c'est d'avoir les réponses dans le mail de réception sinon le formulaire ne sert à rien. :D

Merci d’avance. :wink: