Ok I understand now and I have done something similar. This may not look pretty but it does work well.
PHP Code:
function fetch_positions(){
$acsql="select positionid, accessname from positions p, access a where a.accessid=p.access";
$acquery=mysql_query($acsql);
$num=mysql_num_rows($acquery);
for ($x=0;$x<$num;$x++)
{
$row=mysql_fetch_array($acquery);
echo "position[".$row['positionid']."]='".$row['accessname']."';";
}
That should give you an idea of what you need. In the actual PHP script. This will produce a javascript array that looks like this.
position[0]="Mark"
position[1]="Sean"
position[2]="bravo"
It wouldn't be too hard to adapt to what you need. As for the actual code to make it work I have this.
PHP Code:
<script language="javascript1.2">
<!--
function change_access(value){
var position=new Array();
<?= fetch_options(); ?>
}
//-->
</script>
Of course some of that specifically applys to my script and it is setup in oop so it isn't procedural but you should get the idea. As is it won't work without some minor adjustments but that does what you need it to
Bookmarks