Submit Button variable passing
[email protected] (Ron Piggott)
| Newsgroups | php.db |
|---|---|
| Organization | Acts Ministries Christian Evangelism |
| Message-ID | <[email protected]> |
In the PHP script below I need to be able to pass on the value of
'reference' within the shopping_cart_product table when the "Delete
Category" and "Rename Category" buttons are clicked. How do I do this?
Ron
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT *
FROM shopping_cart_category c
LEFT OUTER JOIN shopping_cart_product p
ON c.reference = p.reference
ORDER BY c.category_name ASC";
$result = mysql_query($query);
if(!$result) die('error: ' . mysql_error());
mysql_close();
$table = "<table>\n";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$table .= "<tr>\n";
$table .= "<td>" . stripslashes($row['category_name']) . "</td>\n";
$table .= "<td><input type=\"button\" name=\"submit\" id=\"delete\"
value=\"Delete Category\" onclick=\"deleteCategory();\"></td>\n";
$table .= "<td><input type=\"button\" name=\"submit\" id=\"rename\"
value=\"Rename Category\" onclick=\"renameCategory();\"></td>\n";
$table .= "</tr>\n";
}
$table .= "</table>\n";
echo $table;