First of all I am displaying a list of values in a table, What I am trying to do is add a delete button based off of the tables unique table id.
So I am trying to delete a value from my database using a this button i have declared, however with what I am doing at the moment it's just not deleting anything to the database.
This is my database table
CREATE TABLE `5050goosedown` (
`goosedown_id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`width` int(8),
`height` int(8),
`normal_fill` int(8),
`our_fill` int(8),
`old_price` DECIMAL(3,2),
`price` DECIMAL(3,2),
PRIMARY KEY (`goosedown_id`)
) TYPE=MyISAM;
this is my button, its inside a form which reloads this same page..
echo '<td><input type="submit" name="'.$row['goosedown_id'].'" value="Delete" /></td>"';
So this is a button that says Delete, and its name is the unique id of that table... (one of the several tabels I have and would like to do this on)
Then when the page reloads I have this if statement to capture the particular delete button being pressed... which is not working atm..
//DELETE QUERIES
if(isset($_POST['goosedown_id']) and is_numeric($_POST['goosedown_id']))
{
// here comes your delete query: use $_POST['deleteItem'] as your id
mysql_query("DELETE FROM 5050goosedown WHERE goosedown_id='goosedown_id'");
}