AnoTest

SortieDocument

Feb 26th, 2021 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. //Made By Samir
  2.  
  3. <!DOCTYPE html>
  4. <html lang="en">
  5. <head>
  6.     <meta charset="UTF-8">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.     <link href="/TEST_PHP/TP MEDIATHEQUE/style.css" rel="stylesheet">
  9.  
  10.     <title>Sortie d'un document </title>
  11. </head>
  12. <body >
  13.     <h2>Sortie d'un document </h2>
  14.    
  15.     <div class="middle">
  16.  
  17.         <form action="" method="POST">
  18.             <td>Numero de sortie</td>
  19.             <input type="text" name="sortNum">
  20.  
  21.             <br></br><td>Date de sortie</td>
  22.             <input type="text" name="sortDate">
  23.  
  24.             <br></br><td>Numero d'un abonne</td>
  25.             <input type="text" name="sortAboNum">
  26.  
  27.             <br></br><td>Reference d'un document</td>
  28.             <input type="text" name="sortDocRef">
  29.  
  30.             <br></br>
  31.             <input type="submit" value="Ajouter" name="submit"></input>
  32.             <input type="submit" value="Effacer" name="erase"></input>
  33.  
  34.         </form>
  35.         <br>
  36.         <a href="../" style="color : inherit;">Retour au menu</a>
  37.  
  38.     </div>
  39.         <?php
  40.  
  41. $con = mysqli_connect('localhost', 'root', 'toor');
  42.  
  43. if(!$con) {
  44.     echo 'Not connected to database';
  45. }
  46.  
  47. if(!mysqli_select_db($con, 'Mediatheque'))
  48. {
  49.     echo 'Database Not selected';
  50. }
  51.  
  52.  
  53. $sortNum = isset($_POST['sortNum']) ? $_POST['sortNum'] : '';
  54. $sortDate = isset($_POST['sortDate']) ? $_POST['sortDate'] : '';
  55. $sortAboNum = isset($_POST['sortAboNum']) ? $_POST['sortAboNum'] : '';
  56. $sortDocRef = isset($_POST['sortDocRef']) ? $_POST['sortDocRef'] : '';
  57.  
  58.  
  59.  
  60.     if(isset($_POST['submit'])) {
  61.  
  62.         if((empty($sortNum) || empty($sortDate) || empty($sortAboNum) ||empty($sortDocRef))) {
  63.             echo '<b>Inserer la/les valeur(s)';
  64.        
  65.         }else{
  66.  
  67.             $sql = "INSERT INTO SORTIE (sortNum,sortDate,sortAboNum,sortDocRef) VALUES ('$sortNum','$sortDate' ,'$sortAboNum','$sortDocRef')";
  68.  
  69.             if(!mysqli_query($con,$sql)) {
  70.                 echo '<b>La sortie n a pas etait enregistrer<b>';
  71.             }else
  72.                 {
  73.                     echo '<b>La sortie est enregistrer<b>';
  74.                 }
  75.    
  76.             }
  77.         }
  78.  
  79. if(isset($_POST['erase'])   ){
  80.     echo '';
  81. }
  82.    
  83.             ?>
  84.  
  85.            
  86. </body>
  87. </html>
  88.  
  89.  
  90.  
Add Comment
Please, Sign In to add comment