PHP: Gestion des boutons radio d’un formulaire

Author:

 formulaire
Download

<html>
 
 <head>
 
 </head>
 
 <body>
<form action="traiRadio.php" method="post">
   <b>Entrez votre nom:</b>
<input type="text" size="45" name="username">
   <b>Sexe:</b> 
<input type="radio" name="sex" value="M">  Masculin
<input type="radio" name="sex" value="F">   Féminin
   <b>Votre email:</b>
<input type="text" size="45" name="email">
<input type="submit" value="Envoyer">
 </form>
 
 </body>
 
</html>
 
<!--
Créer fichier: traiRadio.php
----------------------Script---------------------------
 
<html>
 <head>
 
 </head>
 <body>
 
 
 <?php
  $username = $_POST['username'];
  $sexe =    $_POST['sex'];
  $email =     $_POST['email'];
 
  if( $username != null )
  {
    echo( "<strong>Merci $username</strong>
<hr />" );
  }
 
   echo "Validez vos informations<br/>";
  if( ( $sexe != null ) &#038;& ( $email != null ) )
  {
    $msg = "Sexe: </b>$sexe</b> ";
    $msg .="Email: </b>$email</b> ";
    echo( $msg );
  }
 ?>
 
 </body>
</html>
-->

Leave a Reply

Your email address will not be published. Required fields are marked *


− 4 = five