為什麼新增表單提交的資料傳不到資料庫裡面,點選新增會清空。註解掉後面的add情況判斷連接資料庫是可以連得上的,能試的都試過了就是不知道問題出在哪裡。麻煩大神幫我看看哪裡有問題吧,我停在這個問題很久了。謝謝謝謝謝謝,感激不盡
表單
#<body>
<div>
<form action="addAction.php?action=add" method="get">
<fieldset>
.......
</fieldset>
</div>
<div> <tr>
# <td><a href ="../right.php">返回</td>
<td><input type="submit" name="submit" value="添加"></ td>
<td><input type="reset" name="reset" value="重置"></td>
#</tr>
</form>
</div>
#action運算
##<?phpif ($db_select){
switch ($_GET['action']) {
case 'add'://add
$Rnumber = $_POST['Rnumber'];
$Raddress = $_POST['Raddress'];
$Rtype = $_POST['Rtype'];
$Rstate = $_POST['Rstate'];
$Remark = $_POST['Remark'];
$sql = "insert into room (room_id, room_address, room_type, room_state, room_remark) values ('$Rnumber', '$Raddress','$Rtype','$Rstate','$Remark' )";
$rw = mysql_query($sql);
echo mysql_error();
if ($rw > 0){
echo "<script>alert('新增成功');</script>";
未完待续。。。2019-01-29 11:04:32
$sql = "insert into room (room_id, room_address, room_type, room_state, room_remark) values ('$Rnumber', '$Raddress','$Rtype','$Rstate','$Remark')";
把這個sql語句印出來,去mysql管理工具上看看能不能運作。
而且“<form action="addAction.php?action=add" method="get">”,
你表單用的get提交,接收資料又用的post
$Rnumber = $_POST['Rnumber'];
$Raddress = $_POST['Raddress'];
$Rtype = $_POST['Rtype'] ;
$Rstate = $_POST['Rstate'];
$Remark = $_POST['Remark'];