Del php backend <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "project"; $conn = new mysqli($servername, $username, $password, $dbname); $name = $_POST['name']; $pro_id = $_POST['product_id']; $des = $_POST['description']; $weight = $_POST['weight']; $price = $_POST['price']; $sql = "INSERT INTO product (name, product_id, description, weight,price ) VALUES ('$name', '$pro_id', '$des','$weight','$price')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; ?> <script> window.history.go(-1); </script> <?php } else { echo "Something went wrong"; } ?>