Good morning,
I get this error message and I don’t see where my error is in my code.
Do you have an idea ?
my source code :
<?php
require_once 'db.php';
// ajouter un produit
if(isset($_POST['ajouter']))
{
$code_article = $_POST['code_article'];
$nom_article = $_POST['nom_article'];
$quantite = $_POST['quantite'];
$images=$_FILES['profile']['name'];
$tmp_dir=$_FILES['profile']['tmp_name'];
$imageSize=$_FILES['profile']['size'];
$upload_dir='uploads/';
$imgExt=strtolower(pathinfo($images,PATHINFO_EXTENSION));
$valid_extensions=array('jpeg', 'jpg', 'png', 'gif', 'pdf');
$picProfile=rand(1000, 10000000).".".$imgExt;
move_uploaded_file($tmp_dir, $upload_dir.$picProfile);
$sql ="INSERT INTO `produit`( `code_article`, `nom_article`, `images`, `quantite`)
VALUES (:code_article, :nom_article, :pic, :quantite)";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':code_article', $code_article);
$stmt->bindParam(':nom_article', $nom_article);
$stmt->bindParam(':pic', $picProfile);
$stmt->bindParam(':quantite', $quantite);
$stmt->execute();
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<title>Gestion de stock</title>
</head>
<body>
<header>
<nav class="navbar">
<p class="logo">Gestion De Stock</p>
<ul class="navlinks">
<li><a href="#">Les Produits</a></li>
<li><a href="#">L'etat de stock</a></li>
<li><a href="#">Les Factures</a></li>
<li><a href="#">Les Fournisseurs</a></li>
</ul>
</nav>
</header>
<div class="container">
<div class="row">
<div class="col-2 mt-3">
<form action="" class="form-group mt-3" method="post">
<label for="">Image du Produit :</label>
<input type="file" class="form-control mt-3" name='images'>
<label for="">Code Article :</label>
<input type="text" class="form-control mt-3" name="code_article">
<label for="">Nom du Produit :</label>
<input type="text" class="form-control mt-3" name="nom_article">
<label for="">Quantite :</label>
<input type="text" class="form-control mt-3" name="quantite">
<button type="submit" class="btn btn-primary mt-3" name="ajouter">Enregistrer</button>
</form>
</div>
<div class="col-10 mt-3">
<table class="table table-striped">
<thead>
<th>Image</th>
<th>Code Article</th>
<th>Designation</th>
<th>Quantite</th>
</thead>
<tbody>
<tr>
<td><img src="./images/pentalon.png" alt=" " class="image_product"></td>
<td>1000</td>
<td>Pc Portable HP</td>
<td>250 PC</td>
</tr>
<tr>
<td><img src="./images/pentalon.png" alt=" " class="image_product"></td>
<td>1000</td>
<td>Pc Portable HP</td>
<td>250 PC</td>
</tr>
<tr>
<td><img src="./images/pentalon.png" alt=" " class="image_product"></td>
<td>1000</td>
<td>Pc Portable HP</td>
<td>250 PC</td>
</tr>
<tr>
<td><img src="./images/pentalon.png" alt=" " class="image_product"></td>
<td>1000</td>
<td>Pc Portable HP</td>
<td>250 PC</td>
</tr>
<tr>
<td><img src="./images/pentalon.png" alt=" " class="image_product"></td>
<td>1000</td>
<td>Pc Portable HP</td>
<td>250 PC</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>