我正试图接受多种物品,从形式和到达地点时,用于加工、分立物品,并将它们作为适当物品处理,插入db。 目前发生的情况是,这些项目正作为一个项目列入b。 例如,我进入项目1,项目2,项目3。 这正列入一个栏目。 一栏中所有三个项目。 我如何纠正我的法典,把每个项目放在自己的一栏。 很多人
php page
foreach($_POST[ BRVbrtrv_boxnumber ] as $i=>$value){
$_POST[ BRVbrtrv_boxnumber ][$i]=mysql_real_escape_string($value);
}
$boxnumber = implode( , , $_POST[ BRVbrtrv_boxnumber ]);
$query = INSERT INTO `act` (`service`, `activity`, `department`, `company`, `address`, `user`, `item`, `destroydate`, `date`, `new`)
VALUES ( .$service. , .$activity. , .$department. , .$company. , .$address. , .$authorised. , .strtoupper($boxnumber). , NULL, NOW(), .$new. ); ;
mysql_query($query) or die( Error, query failed );
分类投入
for(var i = 0;i < $(this).val();i++) {
$("#BRVbrtrv_boxnumber").append( <div data-role="fieldcontain"><label for="BRVbrtrv_boxnumber" class="ui-input-text">Enter box + (i + 1) + number:</label><input type="text" name="BRVbrtrv_boxnumber[ +i+ ]" id="BRVbrtrv_boxnumber[ +i+ ]" class="BRV_boxnumber ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c" /></div> )
}
json output
boxnumber: "rff,tgg" <- this is correct values for 2 items that I input
+++UPDATE+++
foreach($_POST[ BRVbrtrv_boxnumber ] as $i=>$value){
$_POST[ BRVbrtrv_boxnumber ][$i]= strtoupper( mysql_real_escape_string($value) );
}
foreach( $_POST[ BRVbrtrv_boxnumber ] as $k => $item_name ){
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-type: application/json");
$json = "";
if(empty($service)) {
$json .= "{"ErrorService": "ERROR: You mest select a service level"}";
}
else
if($department=="Choose Department") {
$json .= "{"ErrorService": "ERROR: You must select a department"}";
}
else
if($address=="Choose Address") {
$json .= "{"ErrorService": "ERROR: You must select a retrieval address"}";
}
else
if(empty($item_name)) {
$json .= "{"ErrorService": "ERROR: You must enter a box for retrieval"}";
}
else
{
$json .= "{
";
$json .= ""boxnumber": "".$item_name."",
";
$json .= ""boxcount": "".$boxcount.""
";
$json .= "}
";
}
}