select-php如何读取下拉菜单选中数据
程序员文章站
2024-01-20 19:53:04
...
selectphp下拉菜单
$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"],"
\n"; echo "Time: ", $row["time1"],"
\n"; echo "Available: ", $row["available2"],"
\n"; echo "Time: ", $row["time2"],"
\n"; echo "Available: ",$row["available"],"
\n";}
?>
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));
?>
推荐阅读
-
select-php如何读取下拉菜单选中数据
-
如何使用tf.data读取tfrecords数据集
-
如何使用tf.data读取tfrecords数据集2
-
读取txt文件写入库数据库,内容带单引号的写入失败,请教如何转义
-
spark从mysql数据库读取1000万条数据 运行速度很慢 如何优化
-
thinkphp 在哪里读取的Conf/conf.php文件里的数据库配置信息,该如何处理
-
php如何读取串口的数据
-
PHP能不能把js文件写入数据库,前台用js文件,直接读取数据库,该如何解决
-
读取xml数据之后smarty的模板应该如何写
-
spark从mysql数据库读取1000万条数据 运行速度很慢 如何优化