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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.