这个问题建立在我之前的这个问题之上......我有一个可以很好提交的 php 表单。我正在向其中添加一个“添加更多”功能,以再次添加整个字段集。
//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";
}
它将采用第一个字段,即 php 添加一个......然后是通过 javascript 添加的第一个字段集(用户添加),但它不会采用第二个或第三个......所以我的数据最终看起来像:
更改访问权限的文件夹的完整路径:t:\this-drive 要更改的用户权限组:dv group 需要读取访问权限的其他用户:jfla 需要作者访问权限的其他用户:azann 要从访问权限中删除的用户:dlint 数据管理员,项目经理,项目负责人,或可以授权访问更改的主管:gpone 审批官员电话号码:888-888-7777
更改访问权限的文件夹的完整路径:o:\driveUser 要更改的权限组:odrive 组需要读取访问权限的其他用户:sjones 需要作者访问权限的其他用户:pvalle 要从访问权限中删除的用户:kpowerData 管理员、项目经理、项目负责人或主管可授权访问变更:bzell 审批官电话:777-777-7777
i:\new i group urusa mmalone jjon yokis 888-999-555
u:\ u group phammer midnite bmarley gdead 777-444-2222
为什么那个 foreach 没有第二次拿起 addQues() ?
VAR_DUMP $_REQUEST
array(22) { ["name"]=> string(1) "" ["email"]=> string(14) "" ["add"]=> 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"] => 字符串(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"]=> array(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" [11]=> string(4) "jjon" [12]=> string(5) "yokis" [13]=>字符串(11)“888-999-555”[14]=>字符串(4)“u:\”[15]=>字符串(7)“u组”[16]=>字符串( 7) "phammer" [17]=> string(7) "midnite" [18]=> string(7) "bmarley" [19]=> string(5) "gdead" [20]=> string(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]=> 字符串(7) "kpow" [5]=> 字符串(8) "bdezl" [6]=> 字符串(12) "777-777-7777" [7]=> string(7) "i:\new" [8]=> string(7) "i group" [9]=> string(5) "urusa" [10]=> string(7) "mmalone" [11] => 字符串(4) "jjon" [12]=> 字符串(5) "yokis" [13]=> 字符串(11) "888-999-555" [14]=> 字符串(4) "u:\ " [15]=> string(7) "u group" [16]=> string(7) "phammer" [17]=> string(7) "midnite" [18]=> string(7) "bmarley" [19]=> 字符串(5) "gdead" [20]=>字符串(12)“777-444-2222”}