안녕하세요, 저는 드롭 다운 메뉴에서 선택할 값에 따라 mysql 테이블의 모든 값을 가진 테이블을 보여주고 싶습니다. 예를 들어 드롭 다운 목록 메뉴에는 open이라는 값이 있습니다. 그 상태를 가진 테이블의 행을보고 싶을뿐입니다. 나는 이것을 위해 Ajax를 사용해야 할 것인가?종속 드롭 다운 내림차순 PHP
내 코드는 무엇입니까?
$status = $_POST['TipoStatus'];
echo '<a href = "rnservices.php"> Create Service</a> ';
echo '</br>';
echo '</tr><tr><td><label for="TipoStatus"> Status:</label></td><td>';
$query = "SELECT TipoStatus FROM status"; // First Remar
$result = queryMysql($query);
if (!queryMysql($query)) {
echo "Query fail: $query<br />" .
mysql_error() . "<br /><br />";
}
else
{
echo '<select name = "TipoStatus" size = "1">'; // or name="toinsert[]"
// echo '<option value="none" selected="selected">None</option>';
while ($row_1 = mysql_fetch_array($result)) {
echo '<option value="' . htmlspecialchars($row_1['TipoStatus']) . ' selected="$row_1[9]" >' // Third remark
. htmlspecialchars($row_1['TipoStatus'])
. '</option>';
}
echo '</select>';
echo '</p>';
}
echo '<table border="1" >';
echo '<tr>';
echo '</br>';
echo '<th> Service ID</th>';
echo '<th>Title</th>';
echo '<th>Description</th>';
echo '<th>Notes</th>';
echo '<th>Submit By</th>';
echo '<th>Assigned Employee</th>';
echo '<th>Assigned Group</th>';
echo '<th>Category</th>';
echo '<th>Status</th>';
echo '<th>Urgency</th>';
echo '<th>Customer</th>';
echo '<th>Day Created</th>';
echo '</tr>';
$query = ("SELECT ServiceID, Title, Description, Notes, SubmitBy, AssignedEmp, " .
"AssignedGroup, NameCategory, TipoStatus, TiposUrgencia, CustomerName, DayCreation FROM Service where TipoStatus = '$status' ");
$result = queryMysql($query);
echo 'resultado' . mysql_num_rows($result);
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td><a href="rnservices1.php?ServiceID='.$row["ServiceID"].'"> '.$row['ServiceID'] .' </a></td>';
echo '<td>' .$row['Title']. ' </td>';
echo '<td>'.$row['Description'].'</td>';
echo '<td>'.$row['Notes'].'</td>';
echo '<td>'.$row['SubmitBy'].'</td>';
echo '<td>'.$row['AssignedEmp'].'</td>';
echo '<td>'.$row['AssignedGroup'].'</td>';
echo '<td>'.$row['NameCategory'].'</td>';
echo '<td>'.$row['TipoStatus'].'</td>';
echo '<td>'.$row['TiposUrgencia'].'</td>';
echo '<td>'.$row['CustomerName'].'</td>';
echo '<td>'.$row['DayCreation'].'</td>';
echo '</tr>';
}
mysqli_free_result($result);
echo $ticket_select;`enter code here`
echo '</table>';
echo '<form method = "post" action "rnseetickets.php">';
?>
JavaScript를 사용하려면 AJAX가 필요합니다. 여기 꽤 좋은 AJAX 튜토리얼을 찾을 수 있습니다 : http://www.w3schools.com/ajax/default.asp – Zak