<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Liste des modèles d'offre</title>
    <link rel="stylesheet" href="stylecli.css" media="all" />
  </head>
  <body >
    
    </header>
    <main>
      <div id="details" class="clearfix">
        <div id="client">
          <div class="to"><h1><br>Liste des modèles d'offre<br></h1></div>
          <h2 class="name"></h2>
          <div class="address"></div>
          <div class="email"></div>
        </div>
        <div id="invoice">
          <h1></h1>
          <div class="date"></div>
          <div class="date"></div>
        </div>
      </div>
		
		
      <table border="0" cellspacing="0" cellpadding="0">
        <thead>
          <tr>
            <th class="no">Type de modèle</th>
            <th class="desc">DESCRIPTION</th>
            <th class="unit"> </th>
          
          </tr>
        </thead>
		  
		  
        <tbody>
			
<?php
			
$SOC=" ";
$NOM1=" ";
$NOM2=" ";
$NOM3=" ";
$NOM4=" ";
$NOM5=" ";
$TITRE=" ";
$PUB=" ";
$AC1=" ";
$AC2=" ";
$O1=" ";
$O2=" ";
$O3=" ";
$MAIL=" ";
$GSM=" ";
$TEL=" ";

// 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);
} 
$SIDXCLI = htmlentities($_POST['idxcli']);
	// print "dans la boite<br>";
			
			
$sql = "SELECT type FROM Modele";
$sql = "SELECT * FROM Modele GROUP BY type";
$result = $conn->query($sql);

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>";
		
		 print "<tr>";
            print " <td class='no'>". $row["type"]."</td>";
           print " <td class='desc'><h3>". $row["nom"]."</h3></td>";
			//print "<form method='post' action='clientaf2.php' name='demande'>";
		print "<form method='post' action='textecreamod.php' name='demande'>";
		 print "<input type='hidden' name='idxcli' value='".$SIDXCLI."'>";
		//print "<input type='hidden' name='idxcli' value='2'>";
            print "<td class='unit'><button name='idxm' type='submit' value='". $row["type"]."'>Suivant</button></td>";
		
			print "</form>";
        
          print "</tr>";
    } 
    
	
	} 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();


		?>	
			<tr>
                <td class='no'></td>
                <td class='desc'>
            <button onclick="window.location.href = 'encodegencond.php';">Modifier Condition générales BASE DOCUMENTS !!!</button>
                    </td>
                <td class='unit'></td>
            </tr>
     
        </tbody>
        
      </table>
     
 
     
  </body>
</html>