Hi thanks for the reply, I do believe I understand what client side and server side really mean although I have much to learn, but is there a way to accomplish what I'm trying to do? Maybe some kind of work around a person has found when doing this kind of thing?
Thanks again, Steve -----Original Message----- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 2:26 PM To: Steve Bradwell; [EMAIL PROTECTED] Subject: Re: [PHP] confused newbie on PHP and Javascript. > I am having a problem, mostly concept wise of how, or if I can use client > side Javascript in a server side php statement. Do you know what client side and server side really mean?? For the function below... > function Modify_Item_Details(){ > > var test = > document.forms[0].item.options[document.forms[0].item.selectedIndex].text; > > <? > $sql = "Select i.QTY_ON_HAND, u.UNIT from items i INNER JOIN"; > $sql.= " units u ON i.Unit_Index = u.Unit_Index"; > $sql.= " where i.Item_Index = '".echo "test\n"."'"; > > $result = mysql_query($sql); > while ($vars = mysql_fetch_array($result)){ > echo "document.forms[0].available.text='".$vars[0]."';"; > echo "document.forms[0].units.text='".$vars[0]."';"; > } > ?> > }//end Modify_Item Details you do realize that the PHP runs first, on the server, right?. The output is then sent to the client and the javascript is exectuted. You can't mix the two. So, when you call that Javascript function, the PHP is already done, it's not going to execute. Do a view source of your page... You can send Javascript variables to PHP by submitting a form or creating a URL to be clicked on. Either way, the page has to be refreshed/submitted in order for PHP to recieve the variable. You can send PHP variables to Javascript, too, but the PHP runs first. <? echo "<script>var test = '$test';</script>"; ?> ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php