View Full Version : Variable Passing to function

06-06-2007, 06:23 PM
I have a program using java that passes two variables to the UpdateItem function but do not know how to add another variable. The java recalculates the quantity and passes this along with the unchanged itemId back to the function UpdateItem. I started adding a third item called install and would like to pass it unchanged to the UpdateItem function but could not get it to work, your assistance would be appreciated

function UpdateQty(item)

function UpdateItem($itemid, $qty, $install)
{global $dbServer, $dbUser, $dbPass, $dbName;
// Get a connection to the database

<select name="<?php echo $row["itemId"]; ?>", install="<?php echo $row["install"]; ?>" onchange="UpdateQty(this)">

for($i = 1; $i <= 20; $i++)
{echo "<option ";
if($row["quant"] == $i)
{echo " SELECTED ";}
echo ">" . $i . "</option>";}?>
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);


06-07-2007, 12:05 AM

First, there is no Java code anywhere in your example. There is JavaScript and PHP code, both are very different from Java.

Second, your UpdateItem function is written in PHP, not in JavaScript.

Please restate your question to address these issues. I'm not sure what you are asking.

06-07-2007, 01:53 AM
I would like to pass a another variable 'install' from the HTML select name through the javascript to the PHP function UpdateItem. Presently the variable 'itemId' is passed unchanged this way and 'qty' is updated for the PHP function.

Hope this helps

06-07-2007, 06:32 PM
Mitch, you can't pass variables from JavaScript to PHP. That is impossible.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum