php实现选择下拉菜单的值保存到数据库
<lable>赴台方式</lable><selectname="way"style="width:80px;"><optionvalue="1">请选择</option>...
<lable>赴台方式</lable>
<select name = "way" style="width:80px;">
<option value="1" >请选择</option>
<option value="飞机" >飞机</option>
<option value="轮船" >轮船</option>
</select>
我这么做是否正确?
<td><input type="submit" class="btn btn-primary" value="添加" name="sub" /></tb>
if(!empty($_POST['sub'])){
@$way = $_POST['way'];
mysql_select_db($db) or die("Unable to select database!");
$query = "INSERT INTO personal(way) VALUE('$way')";
$result = mysql_query($query) or die("Error in query: $query. ".mysql_error());
} 展开
<select name = "way" style="width:80px;">
<option value="1" >请选择</option>
<option value="飞机" >飞机</option>
<option value="轮船" >轮船</option>
</select>
我这么做是否正确?
<td><input type="submit" class="btn btn-primary" value="添加" name="sub" /></tb>
if(!empty($_POST['sub'])){
@$way = $_POST['way'];
mysql_select_db($db) or die("Unable to select database!");
$query = "INSERT INTO personal(way) VALUE('$way')";
$result = mysql_query($query) or die("Error in query: $query. ".mysql_error());
} 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询