pass the value of reference as an argument to your 'deleteCategory()' and
'renameCategory()' functions:
function deleteCategory(refVal) {
... do something with refVal ...
}
function renameCategory(refVal) {
... do something with refVal ...
}
$table = "\n";
while($row = mysql_fetch_array($result
>
> ,MYSQL_ASSOC)) {
>$table .= "\n";
>$table .= "" . stripslashes($row['category_name']) . "\n";
>$table .= " id=\"delete\"
> value=\"Delete Category\" onclick=\"deleteCategory('" . $row['reference']
> . "');\">\n";
>$table .= " id=\"rename\"
> value=\"Rename Category\" onclick=\"renameCategory('" . $row['reference']
> . "');\">\n";
>$table .= "\n";
> }
> $table .= "\n";
hope that helps.
-- matt
On Sat, May 3, 2008 at 1:00 PM, Ron Piggott <[EMAIL PROTECTED]>
wrote:
>
> 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 = "\n";
> while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
>$table .= "\n";
>$table .= "" . stripslashes($row['category_name']) . "\n";
>$table .= " id=\"delete\"
> value=\"Delete Category\" onclick=\"deleteCategory();\">\n";
>$table .= " id=\"rename\"
> value=\"Rename Category\" onclick=\"renameCategory();\">\n";
>$table .= "\n";
> }
> $table .= "\n";
>
> echo $table;
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>