[請益] 請問在submit中讀GET到的變數
<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
推
01/18 23:39, , 1F
01/18 23:39, 1F
※ 編輯: gmoz 來自: 220.142.232.197 (01/19 00:10)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章