PHP$_POST['xxx']发行
booktime.php中的这一行不起作用PHP$_POST['xxx']发行,php,post,server,web,backend,Php,Post,Server,Web,Backend,booktime.php中的这一行不起作用 if(isset($_POST['hair'])){ $hair=$_POST['hair']; $query="SELECT first_name,last_name FROM employee_info e, employee_hair_service h WHERE e.e_id=h.e_id AND h.s_id=".$hair; $query_result=mysqli_
if(isset($_POST['hair'])){
$hair=$_POST['hair'];
$query="SELECT first_name,last_name FROM employee_info e, employee_hair_service h WHERE e.e_id=h.e_id AND h.s_id=".$hair;
$query_result=mysqli_query($con,$query);
while($result_row=mysqli_fetch_array($query_result)){
echo " <option value='-Select-'>".$result_row[0].$result_row[2]."</option>";
}
}
我想在用户选择“头发”选择框后为dresser选择框添加选项,但它不起作用
if(isset($_POST['hair'])){
$hair=$_POST['hair'];
$query="SELECT first_name,last_name FROM employee_info e, employee_hair_service h WHERE e.e_id=h.e_id AND h.s_id=".$hair;
$query_result=mysqli_query($con,$query);
while($result_row=mysqli_fetch_array($query_result)){
echo " <option value='-Select-'>".$result_row[0].$result_row[2]."</option>";
}
}
book.php
<script>
$(document).ready(function(){
$('.book_btn').click(function(){
var colIndex=$(this).index();
var day = $(this).closest("tr").find("td:eq(0)").text();
$.post("booktime.php",{
time: day,
}, function(data,status){
$("#book_time").html(data);
});
});
});
</script>
booktime.php
<?php
$con=mysqli_connect('localhost','root','','hair_salon');
if(isset($_POST['time'])){
$time=$_POST['time'];
echo "<form method='post'><table>
<tr>
<td>Time</td>
<td>".$time."</td>
</tr>
<tr>
<td>Service</td>
<td>
<select name='hair'>
<option selected='selected' value='-Select-'>-Select-</option>";
$con=mysqli_connect('localhost','root','','hair_salon');
$query = "SELECT s_id,s_name FROM hair_service";
$query_result=mysqli_query($con,$query);
while($result_row=mysqli_fetch_array($query_result)){
$s=$result_row[0];
$h=$result_row[1];
echo "<option value=".$s.">".$h."</option>";
}
echo "</select>
</td>
</tr>
<tr>
<td>HairDresser</td>
<td>
<select name='dresser'>;
<option selected='selected' value='-Select-'>-Select-</option>";
if(isset($_POST['hair'])){
$hair=$_POST['hair'];
$query="SELECT first_name,last_name FROM employee_info e, employee_hair_service h WHERE e.e_id=h.e_id AND h.s_id=".$hair;
$query_result=mysqli_query($con,$query);
while($result_row=mysqli_fetch_array($query_result)){
echo " <option value='-Select-'>".$result_row[0].$result_row[2]."</option>";
}
}
echo "</select>
</td>
</tr>
</table></form>";
}
?>
你唯一的发帖时间,不是头发…@lawrencerone,它在book.php中,但是如果你看booktime.php,头发是在表单中,所以它不应该工作吗?我可以在book.php中发布时间,因为一旦用户选择了日期,我就可以获得头发和梳妆台的选择选项