
May 20th, 2001, 07:06 PM
|
|
Contributing User
|
|
Join Date: May 2001
Posts: 37
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
PHP and Javascript Combined
Hi,
I'm working on a Javascript to update 2 listboxes with values, here's where PHP come in. I use PHP to get the values from a Database, but how can I use Javascript variables in PHP code?
What I'm trying to do looks something like this simplified:
<SCRIPT LANGUAGE="Javascript">
function getPerioder(selection)
{
var ftgID = selection.options[selection.selectedIndex].value;
<?php $result2=mysql_query("SELECT * FROM FtgPerioder WHERE ftgID=ftgID");
$object=mysql_fetch_object($result2);
$name=$object->name;
?>
document.form1.perioder.options[0].text=name;
}
</SCRIPT>
The thing I want to do is:
replace ftgID in
mysql_query("SELECT * FROM FtgPerioder WHERE ID=ftgID");
with the javascript variable
Help Greatly needed!
Many Thanks!
Jonas Versén
|