L2 Info : PHP et Programmation Web
 
◃  Ch. 6 Gestion des formulaires  ▹
 

Gestion des champs textuels

  • Formulaire HTML :
    <form action="coursPHP40.php" method="post" target="ongletCible">
      <p><b>Nom : </b>
      <input type="text" name="nom" size="10" /></p>
      <p><b> Prénom : </b>
      <input type="text" name="prenom" size="10" /></p>
      <p><input type="submit" name="envoi"   
             value="Clic" /></p>
    </form>
    
  • Affichage dans le navigateur :

    Nom :

    Prénom :

  • Source de coursPHP40.php :
    <html>
     <body>
    <?php
        echo('Nom: '.$_POST['nom']." <br />\n");
        echo('Prenom: '.$_POST['prenom']." <br/> \n");
        echo('Envoi: '.$_POST['envoi']." <br /> \n");
    ?>
    </body>
     </html>
  • Résultat :
    Nom : Ripley
    Prenom : Hellen
    Envoi : Clic