를 사용하여 두 번째 페이지로 값을 전달하는 방법이 옵션은 데이터베이스에서 오는자바 스크립트 AJAX
<pre>
$query = mysql_query("select * from results");
echo "<select id='date' onchange='showdata()' class='form-control'>";
while ($arr = mysql_fetch_array($query)) {
echo "<option value=".$arr['month'].">".$arr['month']."/".$arr['year']. "</option>" ;
}
echo "</select>";
</pre>
하는 HTML 내 페이지를 선택합니다.
$someVariable = $_GET["someVariable"];
$query = mysql_query("select * from results");
echo "";
while ($arr = mysql_fetch_array($query)) {
echo "".$arr['month']."/".$arr['year']. "" ;
}
echo "";
을 그리고 JS :이 후 나는
<script>
function showdata() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "result.php", true);
xhttp.send();
}
</script>
내가
당신은 여기에 문제가있다, 다른 년의 모든 달은'select'에 대해 같은 값 발생합니다. – jeroen