page1.php
echo '<form action="page2.php" name="myform"><table>
<tr><td>name:<input type="text" name="n"></td></tr>
<tr><td>Choose Desc<select name="desc" value="0">
$descriptions = mysql_query('SELECT desc FROM desc_table');
while($row=mysql_fetch_array($descriptions))
{
$des = $row['desc'];
echo '<option>'.$des.'</option>';
}
</select>
</td></tr>';
<tr><td>Description:<textarea rows="10" cols="10" name="desc" value="1"></textarea></td> </tr>
<tr><td><input type="submit" value="submit"></td></tr>
</table>
</form>';
Page2.php
$n = $_POST['n'];
$desc = $_POST['desc'];
$sql = "INSERT INTO new (name,desc)
VALUES ($n,$desc)";
mysql_query($sql);
我需要通过选择描述或在文本区域中输入描述来存储任一描述,但只有一个描述应该存储到数据库中。