Jump to content

Multiple Post array processing


samtwilliams

Recommended Posts

Afternoon All,

 

I can't seem to work this problem out;

 

I have a form that is generated from a sql list and have two inputs as follows;

<input type="text" name="suppliernumber[]" id="suppliernumber[]" />
<input name="snomed[]" type="checkbox" id="snomed[]" value="<?php echo $row['VPPID']; ?>" />

 

Both are fed to my processing files as arrays, i then run the following foreach which uses the VPPID from the post to search in a database using a where clause.

 

The problem comes when i also need to obtain the data from the suppliernumber $_POST if any has been supplied.

 

My php code;

 

foreach ($_POST['snomed'] as $value) {

$getRecord_sql	=	"SELECT vmps.NM AS NM,  vmpps.QTYVAL AS QTYVAL,  bnf_lookup_subcatagory.BNF_SUBCAT AS BNF_SUBCAT,  bnf_lookup_catagory.BNF_CAT AS BNF_CAT FROM bnf_lookup_catagory INNER JOIN bnf_vmp ON  bnf_lookup_catagory.BNF_CAT =  bnf_vmp.BNF_CAT INNER JOIN bnf_lookup_subcatagory ON  bnf_vmp.BNF_SUBCAT =  bnf_lookup_subcatagory.BNF_SUBCAT RIGHT OUTER JOIN vmps INNER JOIN vmpps ON  vmps.VPID =  vmpps.VPID ON  bnf_vmp.VPID =  vmpps.VPID WHERE VMPPS.VPPID = '$value'";
$getRecord = mssql_query($getRecord_sql);
$row = mssql_fetch_array($getRecord);

$nm = $row['NM'];
$qtyval = $row['QTYVAL'];
$BNF_SUBCAT = $row['BNF_SUBCAT'];
$BNF_CAT = $row['BNF_CAT'];
$SUPPLIER = $_POST['suppliernumber'];

array_push($data_array, array($value, $nm, $BNF_CAT, $BNF_SUBCAT, '', $SUPPLIER, '', '1', '', '', '', '', '', '', '', '1', '', '', $qtyval));

}

 

I can't work out how to add the suppliernumber, i know i need another foreach but can't work out how to do it.

 

Hope someone can help.

 

Sam

Link to comment
https://forums.phpfreaks.com/topic/231383-multiple-post-array-processing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.