這個問題構建off of this question I had earlier ...我有一個PHP表單提交罰款。我在添加了「添加更多」功能,再次添加了整個字段集。foreach沒有獲取陣列數據第二次通過
//access changes
if ($reqtype=="accesschange"){
$subject="FORM: Request Access Change(s) To Exisiting Folder";
$note .="Full Path of folder to change access: $fullpath \n\n";
if($userpermissiongroup != ""){
$note .="User Permission Group to be changed: $userpermissiongroup \n";
}
if($addreadaccess != ""){
$note .="Additional users requiring read access: $addreadaccess \n";
}
if($addauthoraccess != ""){
$note .="Additional users requiring author access: $addauthoraccess \n";
}
if($removeaccess != ""){
$note .="Users to be removed from access: $removeaccess \n";
}
$note .="Data Steward, Program Manager, Project Lead, or Supervisor who can authorize access changes: $supervisor \n\n";
$note .="Phone number of approving official: $phoneapprover \n";
}
如果用戶點擊更多,那麼這的foreach通過添加的字段上運行:
$addQues = array(
"Full Path of folder to change access:",
"User Permission Group to be changed:",
"Additional users requiring read access:",
"Additional users requiring author access:",
"Users to be removed from access:",
"Data Steward, Program Manager, Project Lead, or Supervisor who can authorize access changes:",
"Phone number of approving official:",
);
foreach($_REQUEST['addfield'] as $k => $value) {
$note .= "$addQues[$k] $value";
}
這將需要第1場,那是PHP添加一個...然後第一字段集是通過JavaScript添加(用戶添加),但它不會採取第二或第三...所以我的數據結果看起來像:
文件夾的完整路徑來更改訪問:t:\此驅動器用戶權限 羣將被陳ged:dv組需要讀取訪問權限的其他用戶: jfla其他需要作者訪問權限的用戶:azann用戶爲 已從訪問權限中刪除:dlint數據管理員,項目經理 可授權訪問權限變更的主管或主管:gpone電話號碼 審批官員:888-888-7777
文件夾中更改訪問的完整路徑:O:\ driveUser權限組 改變:odrive groupAdditional用戶需要讀取訪問權限: sjonesAdditional用戶要求筆者查閱:pvalleUsers是 從訪問中刪除:kpowerData管理員,項目經理,項目 可以授權訪問更改的主管或主管:bzellPh正式批准的一個 號碼:777-777-7777
I:\新的I組urusa mmalone jjon yokis 888-999-555
U:\ U基團phammer midnite bmarley gdead 777-444-2222
爲什麼這個foreach沒有再次拾取addQues()?
的var_dump $ _REQUEST
陣列(22){[ 「名稱」] =>串(1) 「」[ 「電子郵件」] =>串(14) 「」[ 「添加」] = > string(0)「」[「citystate」] => string(4)「,」[「phone1」] => string(0)「」[phone2「] => string(0)」「[」reqtype 「] => string(12)」accesschange「[」newpath「] => string(0)」「[」usersaccess「] => string(0)」「[」ryesaccess「] => string(0)」「 [「approvingofficer」] => string(0)「」[「sphone」] => string(0)「」[「comments」] => string(0)「」[「fullpath」] => string(14) 「t:\ this-drive」[「userpermissiongroup」] => string(8)「dv」[「addreadaccess」] => string(9)「jflat」[「addauthoraccess」] => string(5)「bzat」 [「removeaccess」] => string(5)「dlit」[「supervisor」] => string(6)「lnat」[「phoneapprover」] => string(12)「888-888-7777」[「addfield」 ] => ar ray(21){[0] => string(9)「o:\ drive」1 => string(12)「odrive group」[2] => string(6)「sjones」[3] => string 6)「pvae」[4] => string(7)「kpow」[5] => string(8)「bdez」[6] => string(12)「777-777-7777」[7] => string(7)「i:\ new」[8] => string(7)「i group」[9] => string(5)「urusa」[10] => string(7)「mmalone」 => string(4)「jjon」[12] => string(5)「yokis」[13] => string(11)「888-999-555」[14] => string(4)「u:\ 「[15] => string(7)」u group「[16] => string(7)」phammer「[17] => string(7)」midnite「[18] => string(7) [19] =>串(5) 「gdead」[20] =>串(12) 「777-444-2222」} [ 「C_ID」] =>串(0) 「」}
的var_dump我得到的信息將是:var_dumb($ _ REQUEST ['addfield']
array [21] {[0] => string(9)「o:\ drive」1 => string(12)「drive group」[2] => string(6)「sjones」[3] => string(6)「pval」[4] => string(7)「kpow」[5] => string(8)「bdezl」[6] => string(12) 「777-777-7777 (7)「i:\ new」[8] => string(7)「i group」 [9] => string(5)「urusa」[10] => string(7) )「mmalone」[11] => string(4) 「jjon」[12] => string(5)「yokis」[13] => string(11)「888-999-555」[14] =>字符串(4)「u:\」[15] =>字符串(7)「u組」[16] =>字符串(7)「phammer」 [17] =>字符串(7)「midnite」[18 ] => string(7)「bmarley」[19] => string(5) 「gdead」[20] => string(12)「777-444-2222」}
var_dump($ _ REQUEST)的輸出是什麼;'? – Viktor
@Viktor在那裏添加了var_dump。在頂部有一些值沒有立即設置,即...名稱,電子郵件,添加,citystate,phone1,phone2,reqtype ...謝謝。 – jasonflaherty