我正在使用 phpinsert
进入Microsoft SQL表,以下是我的代码:
$server = "**/**,1433";
$connectionInfo = array( "Database"=>"***", "UID"=>"**", "PWD"=>"******" );
$conn = sqlsrv_connect( $server, $connectionInfo );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
if(!empty($_POST['check_list'])) {
foreach($_POST['check_list'] as $check) {
$sql = "SELECT Item.HQID, Item.ItemLookupCode, Item.Description, Item.ExtendedDescription, Item.SalePrice, Item.Price, Item.CategoryID FROM Item WHERE Item.HQID = '$check'";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
$html_table = '<table border="1" cellspacing="0" cellpadding="2">';
$html_table .= '<form method="post" action="upload.php"><tr><td width="350" align ="center">' .$row['Description']. '</td><td width="350" align ="center">' .$row['ExtendedDescription']. '</td><td width="130" align="center">'
.$row['ItemLookupCode']. '<td width="100" align="center">' .$row['SalePrice']. '</td><td width="100" align="center">' .$row['Price']. '</td><td width="200" align="center"><input
type="text" size="24" name="stitle"></td><td width="100" align="center"><input type="text" size="8" name="wprice"></td><td width="120" align="center"><input type="text" size="10" name="scategory"></td><td width="220" align="center"><input
type="text" size="28" name="sbody"></td></tr>';
$html_table .= '</table>';
echo $html_table;
}
}
}
}
?>
<input type="submit" value="Upload this page" ></form>
我有一个<input>
with name="stitle"
,我希望PHP代码从每个中获取值,<input>
但目前它只从第一个中获取值<input>
。我该如何解决?