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
| <?php
//include "./dao.php";
?>
<script src="./jquery/jquery-2.2.3.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./style2.css" />
<title>Ajout produit</title>
</head>
<body>
<?php
$print = true;
if(isset($_POST['prix']) && isset($_POST['color']) && isset($_POST['photo']) && isset($_POST['typep'])){
if($_POST['prix']!='' && $_POST['color']!='' && $_POST['photo']!='' && ($_POST['typep']='bijoux' || $_POST['typep']='vetement')){
$query = "INSERT INTO Produit VALUES('".$_POST['photo']."', '".$_POST['color']."', '".$_POST['prix']."', '".$_POST['typep']."')";
var_dump($query);
echo $_POST['typep'];
$print = false;
}
else{
echo '<script>alert("Veulliez remplir tous les champs");</script>';
}
}
if($print){
echo'
<form id="d" action="AjoutProduit.php" method="post">
<table>
<tr>
<td>Photo :</td>
<td><input type="file" name="photo"></td>
</tr>
<tr>
<td>Prix :</td>
<td><input type="number" step="0.01" min="0" name="prix"></td>
</tr>
<tr>
<td>Couleur :</td>
<td><input type="text" name="color"></td>
</tr>
<tr>
<td>Type : </td>
<td>
<select name="typep">
<option value="bijoux" selected="selected">Bijoux</option>
<option value="vetement">Vetement</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Valider"></td>
</tr>
</table>
</form>
';
}
?>
</body>
</html> |