<?php
mysql_connect("localhost", "root","") or die(mysql_error());
mysql_select_db("tnews2") or die(mysql_error());
$query = "SELECT name,id FROM categories ORDER BY ID DESC LIMIT 0,6";
$result = mysql_query($query) or die(mysql_error()."[".$query."]");?>
<select name="categories">
<?php while ($row = mysql_fetch_array($result)){
?>
<option value=" <?php $row['path']; ?> ">
<?php echo $row['name']; ?>
</option>
<?php
}
?>
</select>?>
所以这是选择选项菜单,它是我从数据库中读取的值,但是当我尝试获取所选值时,我只得到第一个值。
<?php
mysql_connect("localhost", "root","") or die(mysql_error());
mysql_select_db("tnews2") or die(mysql_error());
if(!empty($_POST['title']) && !empty($_POST['date']) && !empty($_POST['txt']) && !empty($_POST['image'])){
$TITLE=$_POST['title'];
$DATE=$_POST['date'];
$TXT=$_POST['txt'];
$IMAGE=$_POST['image'];
$CATEGORIES=$_POST['categories'];
echo $CATEGORIES;
$ANSWER=$_POST['main'];
$MAINPAGE=0;
你能帮我一个想法来获得选定的选项吗