guys. I'm having trouble with obtaining data from my database in order to display it in a textbox. It gives me an error which says Undefined variable: test on line 22
Below is my HTML code snippet that has the error
<tr>
<td width="230">Item Name</td>
<td width="10">:</td>
<td width="294"><input id="item" name= "Item" type="text" class="resizedTextbox" value = "<?php echo $test['item'];?>" required></td>
</tr>
This is my php code snippet.
include("config.php");
if (isset($_GET['item_id']))
{
$sql = "SELECT * FROM inventory WHERE item_id =" .$_GET['item_id'];
$query = mysqli_query($db, $sql);
$test = mysqli_fetch_array($query);
}
I believe I don't have any syntax errors so I'm not sure what is causing the problem. Thanks in advance.