The code below populates a drop-down list that uses javascript to open the same page, but with a different machid. The problem I'm running into is that in the onChange URL the $machid variable does not change. I understand why. The machid is already defined in the URL and so when the script opens the page again it is reading the same machid. I know I can do this using a form, but I would prefer not to.
How can I get change the machid based on the selection value?
Thanks.
<?php
// create SQL statement
$result = mysql_query("SELECT cname,machid FROM inventory WHERE clientid='$clientid' ORDER by cname");
echo " <select name=\"machid\" onChange=\"window.open('index.php?module=inventory&comp=$comp&mode=display&clientid=$clientid&machid=$machid','_self')\">\n";
while ($myrow = mysql_fetch_array($result)) {
echo ' <option value="'.$myrow["machid"].'">'.$myrow["cname"]."</option>\n";
}
echo " </select>\n";
?>