...

View Full Version : call



bunny1
03-24-2007, 06:06 AM
i have a javascript function i want to call within my php script
where should i place the javascript.

iLLin
03-24-2007, 06:27 AM
Anywhere you want before the call.

bunny1
03-24-2007, 06:32 AM
it doesnt seem to recognise it when it's in the head tag.
can it be within the php script?

iLLin
03-24-2007, 06:34 AM
Post up some code on what your trying to accomplish.

bunny1
03-24-2007, 06:38 AM
thanks



<head>

<script language="JavaScript">

function UpdateQty(item)
{
itemId = item.name;
newQty = item.options[item.selectedIndex].text;

document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty;
}

</script>







<?php
.......
echo "<select name='" . $row['Product_ID'] . "' onChange='" . UpdateQty(this) . "'>";
....
?>

iLLin
03-24-2007, 06:41 AM
Your trying to make the javascript call a php call. Change to this



<?php
.......
echo "<select name='" . $row['Product_ID'] . "' onChange='UpdateQty(this)'>";
....
?>

bunny1
03-24-2007, 06:49 AM
ok thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum