I'm currently working on a small project in PHP using XAMPP. I have a search functionality where I'm trying to delete certain records from a MySQL database. However, I'm facing an error message that says "Undefined variable: delete in C:\xampp\htdocs\xampp\Test\HRMS\try\search1.php on line 61".
I'm not sure why this error is occurring and I would really appreciate some help in resolving it. I've been trying to troubleshoot it myself, but I just can't seem to figure out what's wrong with my code.
Here's the code snippet where the error is happening (line 61):
$query = "DELETE FROM employees WHERE id = $delete";
I declared the variable `$delete` earlier in the code and confirmed that it has a value assigned to it. So, I'm not sure why the variable is being flagged as undefined in this particular line.
Any insights or suggestions on how to fix this issue would be highly appreciated. Thank you in advance!