Hi,
In my application there is a table named paytbl_payments_merged in which i have fields like pk_paymentinstrumentid,fk_paytbl_enrolments_enrolmentid,installment1instrument1depositdate,installment1instrument2depositdate,installment1instrument3depositdate,installment2instrument1depositdate,installment3instrument1depositdate etc.
For one enrollmentid there will only be one payment entry in this table .
I have a form in which all the instruments are displayed i.e. type, instrument type instrument number and there are fields which are generated dynamically like datedeposited which a user has to enter.
For this i am generating query to access data for installment1instrument1 installment1instrument2 etc. I am using mysql union to display all the data along with fields to enter data.I have to execute 5 different queries to find out all the instrument details for every installments and then i have used union to display the data accordingly. For e.g. first query to find the data for installment1instrument1, second query to find the data for installment1instrument2 and similarly others.
I have attached the screen shot for the same 
Code:
<?php
foreach($paymentsdeposited as $paymentdeposited)
{
?>
<tr>
<td><?php echo $paymentdeposited[pk_enrolmentid];?></td>
<td><?php echo $paymentdeposited[email];?></td>
<td><?php echo number_format($paymentdeposited[amount],2);?></td>
<td><?php echo $paymentdeposited[instrument];?></td>
<td><?php echo $paymentdeposited[instrumentnumber];?></td>
<td><?php echo $paymentdeposited[dated];?></td>
<td><input type="text" name="txtDateDeposited_<?php echo $paymentdeposited[pk_paymentinstrumentid];?>" class="field date-pick"/></td>
<td><input type="text" name="txtBankName_<?php echo $paymentdeposited[pk_paymentinstrumentid];?>" class="field"/></td>
<td><input type="text" name="txtSlipNo_<?php echo $paymentdeposited[pk_paymentinstrumentid];?>" class="field"/></td>
<td><input type="submit" name="btnSubmit1" value="Submit"/></td>
</tr>
<?php
}
?>
These values are accessed by following code:
foreach ($_POST AS $key => $value) {
if (strpos ($key, '_') !== false) {
list($field, $id) = explode ('_', $key, 2);
if ($value!='') {
if($field=='txtDateDeposited')
{
$date=$value;
$instrumentid=$id;
$flag=true;
}
if($field=='txtBankName')
$bank=$value;
if($field=='txtSlipNo')
$slip=$value;
}
}
}
Right now each field can be associated by pk_paymentinstrumentid but i am unable to associate the fields with insallments type (which installment instruments).
Since there is a single row for each payment and all the fields are in the same table. installment1instrument1depositdate,installment1instrument2depositdate.
How can i distinguish txtDateDeposited_ belongs to installment1instrument1 or installment1instrument2 or other instruments?
Please help me on this.
Thanks