gpt4 book ai didi

PHP:从下拉列表中动态获取值?

转载 作者:行者123 更新时间:2023-11-30 00:38:52 25 4
gpt4 key购买 nike

我需要获取选定的选项值:这是我的代码:

<?php
$conn = mysql_connect("localhost","root","");
if(!$conn)
{
die('Connection refused!'.mysql_error());
}
$dbs = mysql_query("SHOW DATABASES");
echo "<select name=\"dbs_present\">";
$i = 1;
while($res = mysql_fetch_assoc($dbs))
{
echo "<option value=\"$i\">".$res['Database']."</option>";
$i++;
}
echo "</select>";
?>

我可以使用上面的代码在下拉列表中显示 mysql 中存在的数据库,但我无法获取在下拉列表中选择的选项。我怎样才能获得所选的选项,以便我可以显示所选数据库中存在的表?!

最佳答案

u can use this the execution time be less

echo "<option value='".$i."'>".$res['Database']."</option>";

关于PHP:从下拉列表中动态获取值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21952787/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com