PHP-MYSQL组合框值选择 [英] PHP-MYSQL combobox value select
问题描述
以下是在COMBOBOX中填充MYSQL表内容的代码
mysql_connect('localhost','root','');
mysql_select_db('test');
$ sql =select id,descr from firm order by id;
$ records = mysql_query($ sql )或死(mysql_error());
echo< select fv>;
while($ row = mysql_fetch_array($ records))
{
$ fv = $ row ['descr'];
echo< option value ='。$ fv。'>。 $ fv。< / option>;
// echo< option value ='。$ row ['id']。'>。$ row ['descr ']。< / option>;
}
echo< / select>;
echo
;
mysql_free_result($ records);
?>
我正在寻找一种解决方案,以便在PHP变量中获取所选值以供以后使用。
任何建议都将受到赞赏
*表公司由两个colums id和descr组成
sql =选择id,通过id从确定订单中删除;
records = mysql_query(
sql)或死(mysql_error());
echo< select fv>;
while(
Here is the code to populate in COMBOBOX the contents of a MYSQL table
mysql_connect('localhost', 'root', '');
mysql_select_db('test');
$sql = "select id, descr from firm order by id";
$records = mysql_query($sql) or die(mysql_error());
echo "<select fv>";
while($row = mysql_fetch_array($records))
{
$fv = $row['descr'];
echo "<option value='".$fv."'>".$fv."</option>";
//echo "<option value='".$row['id']."'>".$row['descr']."</option>";
}
echo "</select>";
echo "
";
mysql_free_result($records);
?>
I'm looking for a solution to get the selected value in a PHP variable for later use.
Any suggestion will be appreciated
* Table firms consists from two colums id and descr
sql = "select id, descr from firm order by id";
records = mysql_query(
sql) or die(mysql_error());
echo "<select fv>";
while(
这篇关于PHP-MYSQL组合框值选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!