I don't know if this request has to be posted on JavaScript forum or this forum is ok.
I've drop down menu dynamically generated by php while.
Code: Select all
<select name="sel_ship" id = "sel_ship" onchange="getShip();">
<option value="<?php echo $rowShip['hs_id'];?>"><?php echo $rowShip['hs_optname']; ?></option></select>
Every option will have value from 1 to 10.
I needed to have selected option value in $_SESSION['shipid'] upon any change on drop down menu so i used JavaScript code.
I wrote below but its not working.
Code: Select all
function getShip() {
var shipId;
shipId = document.getElementById("sel_ship").value;
<?php $_SESSION['shipid']=$_GET['shipId'];?>
}
JavaScript variable shipId is also working.
I need help because already tried a lot but failed.
Thanks in advance.
Regards