<div dir="ltr"><div><div><div><div><div>First, you have to sanitize user input to prevent SQL Injection.<br></div>Then, you need to check if the Request Method is 'POST'<br><br></div>This snippet should do the trick.<br><br> <?php<br> include('dbConfig.php');<br><br>if ($_SERVER['REQUEST_METHOD'] == 'POST') {<br>    $barcode        = mysqli_real_escape_string($conn, $_POST['barcode']);<br>    $item_type      = mysqli_real_escape_string($conn, $_POST['item_type']);<br>    $donor_name     = mysqli_real_escape_string($conn, $_POST['donor_name']);<br>    $donor_location = mysqli_real_escape_string($conn, $_POST['donor_location']);<br><br>    print("Inserting $barcode, $item_type, $donor_name, $donor_location...<br/>");<br><br>    $sql = "INSERT INTO cr_incoming<br>        (date_donated, barcode, item_type, donor_name, donor_location)<br>    VALUES<br>        (CURDATE(),'" . $barcode . "','" . $item_type . "','" . $donor_name . "','" . $donor_location . "')";<br><br>    $result = mysqli_query($conn, $sql);<br><br>    // Check if insert was successful, otherwise display an error <br>    print('Insert failed ...<br/>');<br>}<br>?><br><br></div>Also change this line like this:<br><br><form action="<?php $_PHP_SELF ?>" method="POST"><br><br></div>PHP_SELF will make the script work regardless of what its actual name is.<br></div>And I think method has to be uppercase, but not sure. <br><br><br></div>