作者bingoton (忍不住一起唱 好聽~)
看板PHP
標題[請益] 延續 firefox vs IE 的問題
時間Fri Jun 13 15:05:23 2008
在上一個問題,
我發現我在IE可寫入資料庫,
但在firefox卻無法寫入資料庫,
最後判斷到
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "fill_form"))
{
$insertSQL = sprintf("INSERT INTO questionnaire (mt_id, name, email, Area, School_name, q03, q04, q04etc, q05, q06, q07_a, q07_b, q07_c, q07_d, q07_e, q08, q08etc, q09, q09yes, q10, q11, q12, q13a, q13b, q13c, q14_a, q14_b, q14_c, bbb) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_SESSION['mt_id'], "text"),
GetSQLValueString($_POST['who_are_name'], "text"),
GetSQLValueString($_POST['who_are_email'], "text"),
GetSQLValueString($_POST['who_are_u3'], "text"),
GetSQLValueString($_POST['who_are_u34'], "text"),
GetSQLValueString($_POST['q03'], "int"),
GetSQLValueString($_POST['q04'], "int"),
GetSQLValueString($_POST['q04etc'], "text"),
GetSQLValueString($_POST['q05'], "text"),
GetSQLValueString($_POST['q06'], "int"),
GetSQLValueString($_POST['q07_a'], "int"),
...插入資料庫動作
mysql_select_db($database_intel, $intel);
$Result1 = mysql_query($insertSQL, $intel) or die(mysql_error());
$insertGoTo = "test2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
網頁程式碼最後的地方是
<form action="<?php echo $editFormAction; ?>" method="POST"
name="fill_form" onSubmit="return confirm_form();">
.
.
.
<input type="hidden" name="MM_insert" value="fill_form">
...
發現 在 IE環境
我可以 echo $_POST["MM_insert"]; //結果為 字串 fill_form
但在 firefox 環境
我一樣 echo $_POST["MM_insert"]; //卻沒有顯示任何值
而我試著 print_r($_POST);
在IE環境
Array (
[idno] => 1000037828 [su] => MTg4NjcyOQ== [cls] => ALL [l] => 105
[all_check] => 1,1,1,1,1,1,1,1, [all_type] => 9,9,1,1,1,1,1,1, [all_num1]
=> 16,9,2,10,2,6,8,6, [all_num2] => 5,5,,,,,9,,
[all_islmt] => 0,0,0,0,0,0,0,0, [all_lmt] => :::::::: [q15] => 3
[ck_who92] => Y [q16] => eqwe [ck_code92] => [ck_who923] => Y [q17_a] => 2008
[q17_b] => 1 [ck_code923] => [q18] => 7 [q19] => 13 [q19etc] => ewew
[q20] => 5 [q20etc] => eqwe [q21] => 3 [q21_time] => eqwe [q22c] => y
[q22d] => y [q23a1] => y
[q23b1] => y [q24] => 1 [ck_who922] => Y [q25] => dsade
[ck_code922] => [Submit2] => 下一頁 [MM_update] => fill_form )
但在firefox 環境
Array ( ) 什麼東西都沒有!
我覺得這是原因所在了,
導致我在 firefox存不進資料庫,
但這是什麼原因,且如何解決呢?
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.122.193.222
※ 編輯: bingoton 來自: 140.122.193.222 (06/13 15:12)
※ 編輯: bingoton 來自: 140.122.193.222 (06/13 15:38)
→ hwakeye:我決的問提出再你的表單寫法有問題 06/13 16:00
→ hwakeye:Server side的code不太可能跟瀏覽器相依… 06/13 16:01
→ hwakeye:我覺得問題出在你的表單寫法有問題(修正第一句推文) 06/13 16:01