I have a table that produces a list of user accounts from mysql db. I would like a button that can delete a user from this list.
Here is my form:
<td><form action="empdelete.php">
<?php echo "<input type='text' name='employee' value='".$employee['username']."'/><button type='submit' class='btn btn-default'>Delete</button>"?>
</form></td>;
Here is my empdelete.php:
<?php
if($_POST['submit'])
{
mysql_connect("host","username","pword") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
$username = $_POST['username'];
$result=mysql_query("DELETE FROM employee WHERE username='$username'") or die(mysql_error());
//confirm
echo "Employee Deleted";
}
?>
The table name is employee and the column name is username. It doesn't seem to be working.. any suggestions?