1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
| <html>
<?php
$conn = mysqli_connect("localhost","root","","stocks");
if (isset($_POST['submit']))
{
$matcommande = $_POST['matcommande'];
$datecommande = $_POST['datecommande'];
$nom = $_POST['nom'];
$designation = $_POST['designation'];
$quantiteachete = $_POST['quantiteachete'];
$prixunitaire = $_POST['prixunitaire'];
$query = "INSERT INTO commande (`matcommande`,`datecommande`,`nom`,`designation`,`prixunitaire`)
VALUES ('$matcommande','$datecommande','$nom','$designation','$prixunitaire','$quantiteachete')";
mysql_query($query) or die(mysql_error());
echo "Successfully Submitted.";
}
?>
<head>
<title> Ajouter une commande</title>
<style type="text/css">
.container{
box-shadow: 1px 1px 30px black;
width:85%;
background-color: rgb(151,199,222);
margin-left: auto;
margin-right: auto;
margin-bottom: 1%;
}
button:hover{background-color: rgb(151,199,222);}
footer{text-align: center;margin-top: 3%; }
body{background-color: #EEE;}
.notifdiv{ border:1px dotted black;text-align: center;margin-left:auto;margin-right:auto;margin-top:1%;background-color:#EEF;width:40%; }
.notif,span{color:red;}
a{text-decoration: none;}
button{
background-color: #EEF;
text-align: right;
width: 170px;
height: 6%;
background-repeat: no-repeat;
background-position: center left;
}
header{text-align: center;background-color: #EEF;}
fieldset{background-color:#EEF;margin-top:0px;margin-left: auto;margin-right: auto; width: 80%;}
.submit{text-align: center;}
input[Value="Ajouter commande "]{
height: 50px;
width: 180px;
background-repeat: no-repeat;
background-position: center left;
text-align: right;
background-image: url('add.png');
background-color: #EEF;
}
.confirm{
text-align: center;
margin-top:0px; ;
margin-bottom: 1em;
color: ;
border:1px solid #a2d246;
width: 60%;
margin-left: auto;
margin-right: auto;
background-color: #ebf8a4;
}
fieldset {
padding:0px 0px 0px 0 px;
margin-bottom:10px;
border:1px solid #DF3F3F;
}
legend {
color:#DF3F3F;
font-weight:bold
}
</style>
</head>
<body>
<fieldset><legend><img src="dd6.png"></legend>
<?php if(isset($message)){?><p class="confirm"><em> <?php echo $message;}?></em></p>
<form method="post" action="tests.php">
<table border="0" cellspacing="5" >
<tr>
<td><label> Réference Commande: </label></td><td><input type="text" name="matcommande" required size="10" /></td>
<td> <label>date commande :</label></td><td><input type="date" name="datecommande" required size="30" value="<?php echo date('Y-m-d', strtotime(date('Y-m-d')));?>"/></td>
</tr><br>
</table>
<table>
<tr>
<td><label>client : </label>
<select name="nom">
<option ></option>
<?php
mysql_connect('localhost', 'root', '') or die(mysql_error());
// mysql_connect($host, $username, $password)
mysql_select_db('stocks') or die(mysql_error());
$result = mysql_query("SELECT nom FROM clients order by nom");
while($row = mysql_fetch_assoc($result)){
echo '<option value="'.$row['nom'].'">'.$row['nom'].'</option>';
}
?>
</select>
</td>
</tr>
</table> <br><br>
<fieldset>
<legend> Tous les Prouduits </legend>
<table style="width:100%" align="center">
<tr>
<th></th>
<th > produits </th>
<th >Prix Hors TVA </th>
<th>Quantité</th>
</tr> <tr>
<?php
try
{
// On se connecte à MySQL
$bdd = new PDO('mysql:host=localhost;dbname=stocks;charset=utf8', 'root', '');
}
catch(Exception $e)
{
// En cas d'erreur, on affiche un message et on arrête tout
die('Erreur : '.$e->getMessage());
}
?>
<?php
$reponse = $bdd->query('SELECT designation,prixunitaire FROM produit ');
// On affiche chaque entrée une à une
while ($donnees = $reponse->fetch())
{
?>
<tr>
<td><input type="checkbox" name="commande[]" /></td>
<td><?php echo $donnees['designation']; ?></td>
<td><?php echo $donnees['prixunitaire']; ?></td>
<td><input type="text" name="quantiteachete[]" ></td>
</tr>
<?php
}
$reponse->closeCursor(); // Termine le traitement de la requête
?>
</table>
</fieldset>
<br><br>
<tr class="submit">
<td colspan="2" align="center"><input type="submit" name="submit" Value="Ajouter commande " /></tr></td>
</table>
</form>
</fieldset>
<br>
</div>
</body>
</html> |
Partager