Advertisement
AnoTest

RetourDocument

Feb 26th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.01 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>Retour d'un document </title>
  11. </head>
  12. <body >
  13.     <h2>Retour d'un document </h2>
  14.    
  15.     <div class="middle">
  16.  
  17.         <form action="" method="POST">
  18.             <!--<td>Numero du retour</td>
  19.             <input type="text" name="retNum">  <br></br>-->
  20.  
  21.            <td>Date de sortie</td>
  22.             <input type="text" name="retDate">
  23.  
  24.             <br></br><td>Numero d'un abonne</td>
  25.             <input type="text" name="retAboNum">
  26.  
  27.             <br></br><td>Reference d'un document</td>
  28.             <input type="text" name="retDocRef">
  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. //$retNum = isset($_POST['retNum']) ? $_POST['retNum'] : '';
  54. $retDate = isset($_POST['retDate']) ? $_POST['retDate'] : '';
  55. $retAboNum = isset($_POST['retAboNum']) ? $_POST['retAboNum'] : '';
  56. $retDocRef = isset($_POST['retDocRef']) ? $_POST['retDocRef'] : '';
  57.  
  58. $today = date("d.m.y");
  59.  
  60.     if(isset($_POST['submit'])) {
  61.  
  62.         if((/*empty($retNum) || */empty($retDate) || empty($retAboNum) ||empty($retDocRef))) {
  63.             echo '<b>Inserer la/les valeur(s)';
  64.        
  65.         }else{
  66.  
  67.            // $sql = "INSERT INTO RETOUR (/*retNum*/,retDate,retAboNum,retDocRef) VALUES ('$retDate' ,'$retAboNum','$retDocRef')";
  68.             //$sql = "SELECT DATEDIFF('2012/04/05', '2020/20/20')";
  69.             //$sql = "SELECT DATEDIFF( '$retDate','2020/05/05')";
  70.             //SELECT sortDate,  retDate, DATEDIFF(retDate ,sortie.sortDate) FROM `retour`, `sortie` WHERE 'ab1'=  sortie.sortAboNum
  71.             $sql = " SELECT sortDate,  retDate, DATEDIFF(retDate ,sortie.sortDate) FROM retour, sortie WHERE '$retAboNum'=  sortie.sortAboNum"
  72.             $resultat = mysqli_query($con,$sql);
  73.            
  74.             if(!mysqli_query($con,$sql)) {
  75.                 echo '<b>Le retour n a pas etait enregistrer<b>';
  76.             }else
  77.                 {
  78.                    
  79.                     echo '<b>Le retour est enregistrer !<b><br>';
  80.                     echo 'Nombre de jour de retour :';
  81.                     //print_r($resultat);
  82.                  $row = mysqli_fetch_assoc( $resultat);
  83.                     print_r($row);
  84.                  
  85.                 }
  86.    
  87.             }
  88.         }
  89.  
  90. if(isset($_POST['erase'])   ){
  91.     echo '';
  92. }
  93.  
  94. echo '<br>Date du Jour : ';
  95. echo date($today);
  96.  
  97.    
  98.             ?>
  99.  
  100.            
  101. </body>
  102. </html>
  103.  
  104.  
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement