看板 PHP 關於我們 聯絡資訊
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 中間是HTML碼.. <?php require_once ('../mysql_connect.php'); mysql_query("SET CHARACTER SET 'utf8'"); echo' <input type="submit" value="送出" name="submit"></b></font>'; $id=$_GET['uid']; echo $id; //這行的$id可以正常秀出來,只要放到if(isset($_POST['submit'])) //之後$id就變成null了 if(isset($_POST['submit'])) { for($s=1;$s<7;++$s) { if($_POST["item$s"]) //這是核取方塊 可正常運作 { include("item.php"); $test=$_POST["t$s"]; settype($test, "integer"); $allmoney=($money*$test); $query="INSERT INTO order_item (uid,qty,unitprice,item) VALUES('$id','$test','$allmoney','$s')"; $result =@mysql_query($query); echo"$id-$test-$allmoney-$s"; // 這行只會跑出 -xx-xx-x // 也就是$id變成null了 if ($result!=0) echo '新增成功!'; else echo'<font color="red">發生預期外的錯誤,請洽網頁管理員。 </font>'; } } } mysql_close(); ?> -- Why are you living here! I wanna make this land safe! Why are you living here! Solider! I'm here because I'm boring~~!!! Don't you never forget it.... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.142.232.197
cleanwind:你不覺得該給個 code 嗎@@" 01/18 23:39
※ 編輯: gmoz 來自: 220.142.232.197 (01/19 00:10)