Advertisement
mmouhib

pipedown

Nov 29th, 2021 (edited)
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.11 KB | None | 0 0
  1. //main.php
  2. <?php
  3.  
  4.     $br = '<br>';
  5.  
  6.     $content = '<h3>Inscription</h3>';
  7.  
  8.     $type = "button";
  9.  
  10.     $form = '<form method="post" action="script.php">';
  11.  
  12.     $buttonOne = '<input type="submit" name="afficher" value="afficher">';
  13.     $buttonTwo = '<input type="submit" name="affichertab"  value="affichertab">';
  14.  
  15.  
  16.     $nom = 'Votre nom: <input type="text" name="nom">';
  17.     $prenom = 'Votre prénom : <input type="text" name="prenom">';
  18.  
  19.     $genres = '';
  20.  
  21.     for ($i=0; $i < 2; $i++) {
  22.         if ($i == 0) {
  23.             $genres = $genres . '<input type="radio" name="genre" value="H" checked>Homme';
  24.         }
  25.         else {
  26.             $genres = $genres . '<input type="radio" name="genre" value="F" >femme <br>';
  27.         }
  28.     }
  29.  
  30.     $list = 'Pays <select name="pays">';
  31.     $checkBoxes = 'connaissance en informatique : <br>';
  32.  
  33.     for ($i=0; $i < 3; $i++) {
  34.         if ($i == 0) {
  35.             $list = $list . '<option value="tun">tunisie </option>';
  36.             $checkBoxes = $checkBoxes . '<input type="checkbox" name="pro" value="PRO"> programmation <br>';
  37.         }
  38.  
  39.         elseif ($i == 1) {
  40.             $list = $list . '<option value="alg">algerie </option>';
  41.             $checkBoxes = $checkBoxes . '<input type="checkbox" name="sys" value="SYS"> systeme <br>';
  42.         }
  43.  
  44.         else {
  45.             $list = $list . '<option value="mar">maroc </option> </select>';
  46.             $checkBoxes = $checkBoxes . '<input type="checkbox" name="res" value="RES"> reseaux <br>';
  47.         }
  48.     }
  49.  
  50.     $endForm = '</form>';
  51.  
  52.    
  53.    
  54.  
  55.  
  56.  
  57.  
  58.     $content = $content . $form  . $br . $nom . $prenom .
  59.     $br . $genres . $list . $br . $checkBoxes .
  60.     $br. $buttonOne . $br . $buttonTwo . $endForm;
  61.  
  62.     echo $content;
  63.  
  64.  
  65.    
  66.  
  67. ?>
  68.  
  69.  
  70. //script.php
  71. <?php
  72.  
  73.     if (isset($_POST["nom"]))
  74.     {
  75.         $nom=$_POST["nom"];
  76.     }
  77.  
  78.     if (isset($_POST["prenom"]))
  79.     {
  80.         $prenom=$_POST["prenom"];
  81.     }
  82.  
  83.     if (isset($_POST["genre"]))
  84.     {
  85.         $genre=$_POST["genre"][0];
  86.     }
  87.  
  88.     if (isset($_POST["pays"]))
  89.     {
  90.         $pays=$_POST["pays"][0];
  91.     }
  92.  
  93.     if (isset($_POST["pro"]))
  94.     {
  95.         $pro=$_POST["pro"];
  96.     }
  97.  
  98.     if (isset($_POST["sys"]))
  99.     {
  100.         $sys=$_POST["sys"];
  101.     }
  102.  
  103.     if (isset($_POST["res"]))
  104.     {
  105.         $res=$_POST["res"];
  106.     }
  107.  
  108.  
  109.     echo " votre nom est ".$nom.
  110.         "<br> votre prenom est: ".$prenom.
  111.         "<br> votre genre est: ".$genre.
  112.         "<br> votre pays est: ".$pays.
  113.         "<br> vos connaissances sont :<br>";
  114.  
  115.        
  116.     if (isset($_POST["pro"]))
  117.     {
  118.         echo $pro."<br>";
  119.     }
  120.  
  121.     if (isset($_POST["sys"]))
  122.     {
  123.         echo $sys."<br>";
  124.     }
  125.  
  126.     if (isset($_POST["res"]))
  127.     {
  128.         echo $res."<br>";
  129.     }
  130.  
  131.  
  132.   echo "
  133.  <table border='1'>
  134.  <tr>
  135.  <td>nom</td>
  136.  <td>"."$nom"."</td>
  137.  </tr>
  138.  
  139.  <tr>
  140.  <td>prenom</td>
  141.  <td>"."$prenom"."</td>
  142.  </tr>
  143.  
  144.  <tr>
  145.  <td>sexe</td>
  146.  <td>"."$genre"."</td>
  147.  </tr>
  148.  
  149.  <tr>
  150.  <td>pays</td>
  151.  <td>"."$pays"."</td>
  152.  </tr>
  153.  
  154.  <tr>
  155.  <td>pays</td>
  156.  <td>"."$sys"."</td>
  157.  </tr>
  158.  
  159. </table>
  160.  
  161.  ";
  162. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement