Submit Button variable passing
| From: | Ron Piggott | Date: | Sat, 03 May 2008 18:00:19 +0000 |
| Subject: | Submit Button variable passing | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-44959@lists.php.net to get a copy of this message | ||
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;