Submit Button variable passing

Submit Button variable passing

am 03.05.2008 20:00:19 von Ron Piggott

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 .= "\n";
$table .= "\n";
$table .= "\n";
$table .= "\n";
}
$table .= "
" . stripslashes($row['category_name']) . " value=\"Delete Category\" onclick=\"deleteCategory();\"> value=\"Rename Category\" onclick=\"renameCategory();\">
\n";

echo $table;


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Submit Button variable passing

am 04.05.2008 05:06:43 von Matt Anderton

------=_Part_11267_33424366.1209870403614
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

pass the value of reference as an argument to your 'deleteCategory()' and
'renameCategory()' functions:



$table = "

\n";
while($row = mysql_fetch_array($result
>
> ,MYSQL_ASSOC)) {
> $table .= "\n";
> $table .= "\n";
> $table .= "\n";
> $table .= "\n";
> $table .= "\n";
> }
> $table .= "
" . stripslashes($row['category_name']) . " > id=\"delete\"
> value=\"Delete Category\" onclick=\"deleteCategory('" . $row['reference']
> . "');\">
> id=\"rename\"
> value=\"Rename Category\" onclick=\"renameCategory('" . $row['reference']
> . "');\">
\n";


hope that helps.

-- matt



On Sat, May 3, 2008 at 1:00 PM, Ron Piggott
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 .= "\n";
> $table .= "\n";
> $table .= "\n";
> $table .= "\n";
> }
> $table .= "
" . stripslashes($row['category_name']) . " > id=\"delete\"
> value=\"Delete Category\" onclick=\"deleteCategory();\">
> id=\"rename\"
> value=\"Rename Category\" onclick=\"renameCategory();\">
\n";
>
> echo $table;
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

------=_Part_11267_33424366.1209870403614--