<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Liste client</title>
     <link rel="stylesheet" href="css/bootstrap.css" media="all" />
      
  </head>
    
<div class="container">
    <br>
   
    
<?php
			
$SOC=" ";
$NOM1=" ";
$NOM2=" ";
$NOM3=" ";
$NOM4=" ";
$NOM5=" ";
$TITRE=" ";
$PUB=" ";
$AC1=" ";
$AC2=" ";
$O1=" ";
$O2=" ";
$O3=" ";
$MAIL=" ";
$GSM=" ";
$TEL=" ";
$FAC1=" ";
$FAC2=" ";
$FAC3=" ";
$FAC4=" ";
// on se connecte à notre base

$servername = "localhost:8889";
$username = "test";
$password = "test";
$dbname = "Clients";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT * FROM data where nom1 LIKE '%".$_POST['client']."%' OR societe LIKE '%".$_POST['client']."%' LIMIT 5";
//$sql = "SELECT * FROM data WHERE id=1";
$result = $conn->query($sql);
$cplcard=0;
if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        //echo "Soc: " . $row["societe"]. " - Nom: " . $row["nom1"]. " - idx: " . $row["id"]. " " . $row["nom2"]. "<br>";
		//echo "Soc: " . $row["societe"]. " - Nom: " . $row["nom1"]. "  " . $row["nom2"]. "<br>";
      if ($cplcard == 0) {	 print" <div class='row'>";}
       print"<div class='col-sm-6''>";
		
      
     print "<div class='card' >";
  print "<div class='card-body'><h5 class='card-title'>". $row["nom1"]. "</h5>";
   print " <h6 class='card-subtitle mb-2 text-muted'>". $row["societe"]."  ". $row["nom2"]."<br> ". $row["nom3"]."</h6>";
        print $row["id"];
   //print " <p class='card-text'>Some quick example text to build on the card title and make up the bulk of the card's content.</p>";
   //print" <a href='#' class='card-link'>Card link</a> <a href='#' class='card-link'>Another link</a> ";
  print"<div style='float:right;'> <form method='post' action='pdfdrop.php' name='demande'>";
            print "<button class='btn btn-primary' name='dnumdevis' type='submit' value='". $row["nom1"]."'>Suivant</button></form></div>";
		
		if ($cplcard == 1) {	
   print"</div></div></div></div>";$cplcard=0;}else{	  $cplcard=1;print"</div></div></div>";}
            

        
        
		
      
    } 
     // print $sql;
	
	} else {
    echo "0 results";
}

//$sql = "INSERT INTO data (societe,nom1,nom2,nom3,nom4,nom5,titre,ac1,ac2,o1,o2,o3,mail,tel,gsm,pub,jour)
//VALUES ('$SOC' , '$NOM1', '$NOM2', '$NOM3', '$NOM4', '$NOM5', '$TITRE', '$AC1', '$AC2', '$O1', '$O2', '$O3', '$MAIL', '$TEL', '$GSM', '$PUB', //'$today')";


$conn->close();


		?>	
    </div>
</html>
			