8791 sujets

Développement web côté serveur, CMS

Bonjour à tous,

Voilà j'ai créé il y à quelques jours un formulaire d'inscription mais étant débutant en PHP, j'ai quelques difficultés avec certains éléments.

J'ai effectué pas mal de recherche mais je ne trouve pas la solution et j'espère donc que vous pourrez m'aider!

Voici l'HTML:

<form method="post" action="sendemail.php" id="inscriptionForm"> 
   <fieldset>
      <label for="equipe">Nom de l'équipe:</label>
      <input type="text" name="equipe" id="equipe" />
      <label for="mailCapitaine">e-mail du capitaine:</label>
      <input type="text" name="mailCapitaine" id="mailCapitaine" />
   </fieldset>
      
   <fieldset>
   <legend>Choisissez une catégorie:</legend>
      <ul>
         <li><label for="folklore">Folklore: </label><input type="radio" id="folklore" name="categorie" value="folklore" /></li>
        
         <li><label for="vitesse">Vitesse: </label><input type="radio" id="vitesse" name="categorie" value="vitesse" /></li>
        
         <li><label for="mouvement">Mouvement de jeunesse: </label><input type="radio" id="mouvement" name="categorie" value="mouvement de jeunesse" /></li>
      </ul>
   </fieldset>
   
   <fieldset>
   <legend>Inscrivez les participants (6 min et 15 max):</legend>
      <table>
	     <tr>
            <th>Nom</th><th>prénom</th><th>e-mail</th>
         </tr>
		 
         <tr>
		    <th><input type="text" name="nom1" id="nom1" /></th><th><input type="text" name="pre1" id="pre1" /></th><th><input type="text" name="mail1" id="mail1" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom2" id="nom2" /></th><th><input type="text" name="pre2" id="pre2" /></th><th><input type="text" name="mail2" id="mail2" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom3" id="nom3" /></th><th><input type="text" name="pre3" id="pre3" /></th><th><input type="text" name="mail3" id="mail3" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom4" id="nom4" /></th><th><input type="text" name="pre4" id="pre4" /></th><th><input type="text" name="mail4" id="mail4" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom5" id="nom5" /></th><th><input type="text" name="pre5" id="pre5" /></th><th><input type="text" name="mail5" id="mail5" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom6" id="nom6" /></th><th><input type="text" name="pre6" id="pre6" /></th><th><input type="text" name="mail6" id="mail6" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom7" id="nom7" /></th><th><input type="text" name="pre7" id="pre7" /></th><th><input type="text" name="mail7" id="mail7" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom8" id="nom8" /></th><th><input type="text" name="pre8" id="pre8" /></th><th><input type="text" name="mail8" id="mail8" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom9" id="nom9" /></th><th><input type="text" name="pre9" id="pre9" /></th><th><input type="text" name="mail9" id="mail9" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom10" id="nom10" /></th><th><input type="text" name="pre10" id="pre10" /></th><th><input type="text" name="mail10" id="mail10" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom11" id="nom11" /></th><th><input type="text" name="pre11" id="pre11" /></th><th><input type="text" name="mail11" id="mail11" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom12" id="nom12" /></th><th><input type="text" name="pre12" id="pre12" /></th><th><input type="text" name="mail12" id="mail12" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom13" id="nom13" /></th><th><input type="text" name="pre13" id="pre13" /></th><th><input type="text" name="mail13" id="mail13" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom14" id="nom14" /></th><th><input type="text" name="pre14" id="pre14" /></th><th><input type="text" name="mail14" id="mail14" /></th>
		 </tr>
		 <tr>
		    <th><input type="text" name="nom15" id="nom15" /></th><th><input type="text" name="pre15" id="pre15" /></th><th><input type="text" name="mail15" id="mail15" /></th>
		 </tr>
      </table>
   </fieldset>
   
   <div>
      <input type="submit" name="submit" id="buttonsend" value="Send" />
   </div>
</form>


et voilà ou j'en suis pour le PHP:

<?php
//Plusieurs destinataires
$to  = 'monmail@gmail.com' . ', '; // notez la virgule
$to .= 'monmail@hotmail.com';

//Sujet
$subject = 'Formulaire d\'inscription';

$equipe     	= $_POST['equipe'];
$mailCapitaine  = $_POST['mailCapitaine'];	
$categorie  	= $_POST['categorie'];

	if(strlen($_POST['equipe']) < 1 ){
		echo  'email_error';
	}
	
	else if(strlen($mailCapitaine) < 1 ) {
		echo 'email_error';
	}

  else {
	//message
	$message="\n\n" .
		
		$equipe .
		"\n" .
		$mailCapitaine .
		"\n" .
		$categorie .
		"\n" .
		"\n\n" ;
		
		$message = trim(stripslashes($message));
		
		//Envoi
		mail($to, $subject, $message);
  }
?>


Je n'ai pas de problème lors de l'envoi des premiers éléments mais je ne sais pas du tout comment recevoir les informations qui sont entre les balise <table>.

D'avance, je vous remercie de l'aide que vous m'apporterez!
Comme ça:

$message="\n\n" .

$equipe .

"\n" .

$mailCapitaine .

"\n" .

$categorie ."\n" .
"Email:".$_POST['mail1']."\n" .
"Nom:".$_POST['pre1']."\n" .
....etc

"\n" .

"\n\n" ;