select-php如何读取下拉菜单选中数据

WBOY
Lepaskan: 2016-06-02 11:32:54
asal
1654 orang telah melayarinya

selectphp下拉菜单

<code>$con = mysqli_connect($db_hostname,$db_username,$db_password,$db_database);if (!$con) die("Unable to connect to MySQL: ".mysqli_connect_error());$query = "select * from tutorials";$result = mysqli_query($con,$query);$result || die("Database access failed: ".mysqli_error($con));$rows = mysqli_num_rows($result);while ($row = mysqli_fetch_assoc($result)) {    echo "Day: ", $row["day"],"<br>\n";    echo "Time: ", $row["time1"],"<br>\n";    echo "Available: ", $row["available2"],"<br>\n";    echo "Time: ", $row["time2"],"<br>\n";    echo "Available: ",$row["available"],"<br><br>\n";}</code>
Salin selepas log masuk

?>

Please choose a day from above timetable:


Select a day
$query = "select day from tutorials";
$result = mysqli_query($con,$query);
$result || die("Database access failed: ".mysqli_error($con));
while ($rows = mysqli_fetch_assoc($result)) {
?>

Please choose one time:


Select a time
if(isset($_POST['submit']))
$day = $_POST['selectDay'];
echo "The day is $day";
$query = "select time1 from tutorials where day='$day'";
$result = mysqli_query($con,$query);
$result || die("Database access failed: ".mysqli_error($con));
?>

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan