如何根据下拉选项将用户重定向到不同的页面

时间:2017-03-30 13:12:37

标签: php

我正在尝试从数据库和输入字段输出学生姓名,根据课程和科目的下拉选择输入结果

1 个答案:

答案 0 :(得分:-2)

function ridectMe(){
/*get the data choose*/
  var std = $("#test").val();
  /*you can see the value has been choose*/
  alert("selected : "+std);
  /*if you want to redect the pages, u can use */
  window.location.href="https://localhost/index.php?id="+std+"";
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<select id="test" onchange="ridectMe()">
<option value="test1">student 1</option>
<option value="test2">student 2</option>
<option value="test3">student 3</option>
</select>