Hi I am trying to add buttons to a table so I can delete table rows in a database and need help.
Sorry if I posted in the wrong section to me this looks like a php problem. And I tried doing a search but not sure what to search for.
Here is the form that posts to delete_special.php
<form action="data/delete_special.php" method="post">
<input type="hidden" name="delete_id" value="
<?php echo $row['id']; ?>" />
<input type="submit" value="Delete" />
</form>
delete_special.php
[code]<?php
error_reporting(E_ALL);//all errors
echo "<br>";
var_dump(); //whats in variable
echo "<br>";
var_dump($_POST); //whats in post
echo "<br>";
echo "Row ID ="; echo $_POST['delete_id'];
// Connect to database server
mysql_connect("localhost", "root", "usbw") or die (mysql_error ());
// Select database
mysql_select_db("fruit") or die(mysql_error());
// The SQL statement that deletes the record
$strSQL = "DELETE FROM special WHERE id = $_POST['delete_id'];
mysql_query($strSQL);
// Close the database connection
mysql_close();
//header('Location: index.php');
?>[/code]
Thanks for the reply.