Trending News
問卷測試錯誤.. Notice: Undefined ind
做問卷網頁測試時(架在Wamp Server2.0g-1底下)~ 出現以下錯誤~ 請問各位大大知道是哪裡出了問題嗎?
說明... 該題是複選題(共八項)~ 我在測試時只點選其中一項~ 所以出現數字1. 若是點兩項.會出現數字2. 依此類推
Notice: Undefined index: checkbox19-2 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
Notice: Undefined index: checkbox19-3 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
Notice: Undefined index: checkbox19-4 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
Notice: Undefined index: checkbox19-5 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
Notice: Undefined index: checkbox19-6 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
Notice: Undefined index: checkbox19-7 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
Notice: Undefined index: checkbox19-8 in C:\Wamp Server2.0g-1\www\Jen\questionnaire3.php on line 118
1
記得好像是要修改某個檔案~ 但忘了...
php.ini 檔中(C:\Wamp Server2.0g-1\bin\php\php5.2.9-1 底下的嗎??) 看到很多個『error_reporting = .......』. 應該選哪個才對???
例如有...
; - error_reporting = E_ALL [Code Cleanliness, Security(?)]
; By default, PHP suppresses errors of type E_NOTICE. These error messages are emitted for non-critical errors, but that could be a symptom of a bigger problem. Most notably, this will cause .................
Examples:
; - Show all errors, except for notices and coding standards warnings
;error_reporting = E_ALL & ~E_NOTICE
; - Show all errors, except for notices
;error_reporting = E_ALL & ~E_NOTICE | E_STRICT
; - Show only errors
;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
; - Show all errors, except coding standards warnings
error_reporting = E_ALL
還是會出現耶~~~ 急急急急急急急急急急急急急急急急急急急急急
加了 error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
後沒有出現NOTICE和WARNING事項了~
但還是會顯示出該題選了幾項 (數字 1~N)
這題是複選題~~ 每勾選一項~ 傳回值會+1
$b3empty = 0;
for($b3num = 1; $b3num < 10; $b3num++)
{ $checkbox27 = "checkbox27-".$b3num;
if(empty($_POST[$checkbox27]))
$b3empty = $b3empty + 1;
}
if($b3empty == 9)
{ echo " ";
exit;
}
$checkbox27 = 0;
for($num = 1; $num < 10; $num++)
{ $check = "checkbox27-".$num;
if($_POST[$check])
$checkbox27 = $checkbox27 + 1;
}
$_SESSION["checkbox27"]=$checkbox27;
echo $checkbox27;
1 Answer
- HarmonicaLv 71 decade agoFavorite Answer
您是管理者可以修改 PHP 伺服器
將 php.ini 內的 reporting 部份修改,讓 notice 不顯示
error_reporting = E_ALL; display all errors, warnings and notices
改成
error_reporting = E_ERROR & ~E_NOTICE & ~E_WARNING
-------------------------------------------
您是一般使用者
將出現錯誤的敘述前面加上 @ 表示這行敘述如果有錯誤或是警告時不要輸出
如:@$page=$_GET["page"]
就是修改 questionnaire3.php 的第 118 行
在最前面加 @
2009-12-02 07:35:14 補充:
前面有分號【;】都是註解,沒有作用。
所以請將最後一行
error_reporting = E_ALL
改成
error_reporting = E_ERROR & ~E_NOTICE & ~E_WARNING
改好請重啟網頁服務試試。
2009-12-02 07:35:27 補充:
前面有分號【;】都是註解,沒有作用。
所以請將最後一行
error_reporting = E_ALL
改成
error_reporting = E_ERROR & ~E_NOTICE & ~E_WARNING
改好請重啟網頁服務試試。
2009-12-03 16:39:24 補充:
php 原始碼可以參考一下嗎?
不懂這句:
但還是會顯示出該題選了幾項 (數字 1~N)
如果字數太多
可壓縮後傳
2009-12-04 15:24:11 補充:
php 功力不夠,看不出來,
不過會印出 "字" 的,
好像只有
echo $checkbox27;