Set Session variable using javascript
问题 <script type="text/javascript"> function checkQuery() { var val = form1.proDown.options[form1.proDown.options.selectedIndex].value; var txt = form1.proDown.options[form1.proDown.options.selectedIndex].text; //alert(val+' | '+txt); <?php $_SESSION['value1']= ?> = txt; <?php ; ?> } </script> I have this code and it does not Work? Any One have solution for accessing javascript variable into $_SESSION[]. 回答1: I think you should use xhr(Ajax) to store your data into php session. Following is a