Jump to content

foreach statement and submit


Zyncmaster2006

Recommended Posts

Hi i got a foreach script that displays a something like this:

----------------------------------------------------------------------------------------------------
| | | | |
|  Name    | Monthly Payment      | Principal Amount  Interest    |
| | | | |
-----------------------------------------------------------------------------------------------------
| |
| ARON Jeff | 76125371273571253   |  1231231231    |        0.18  |
| | | | |
|Davis Genn | 89089808098098908   |  6786283764   |        0.18 |
| | | | |
| | | | |
|Steel, Max | 9787879797123423   | 2234587345  |        0.12 |
| | | | |
| | | | |
----------------------------------------------------------------------------------------------------

The reason why display it like that because i can't seem to attach the pciture version. Anyway, I created that form by using foreach. what i want to happen is how can i submit all that data althogether and store it in their designated tables in the database as shown above. 

here is the code:
<?php
global $session;

    $loan_type_ID = $_GET['loan_type_ID'];
$loan_accnt_ID = $_GET['loan_accnt_ID'];
$monthly = $_GET['amount_of_loan'];
$amount = $_GET['amount'];
$or_no = $_GET['or_no'];
$members = getMembers($session[loan_type_ID],$session[loan_accnt_ID]);

if(!$members)
{
print "No members yet.<p>";
return;
}

print"
<table width='852' border='0' cellspacing='2' cellpadding='4' class = 'header2'>
<tr>
    <td colspan='6'>OR no: $or_no </td>
  </tr>
  <tr><td width='68'><div align='center'>Paid</div></td>
    <td width='285'><div align='center'>Name</div></td>
    <td width='132'><div align='center'>Monthly Payment</div></td>
    <td width='110'><div align='center'>Principal</div></td>
    <td width='111'><div align='center'>Interest</div></td></tr>
  <tr>";
foreach ($members as $row)
{
print "<td><div align='center'>
          <input type='checkbox' name='col_paid' value='paid' />
      </div></td><td align='center'>
$row[last_name], $row[first_name] $row[mid_name] <br></a></td>
    <td><div align='center'><input name='form[amount]' type='text' class='ctrl' id='form[amount]' size='20' ></div></td>
    <td><div align='center'>$row[amount_of_loan]</div></td>
    <td><div align='center'><input name='form[interest_rate]' type='text' class='ctrl' id='form[interest_rate]' size='20' value=' $row[interest_rate]'></div></td>
</tr></form>";
}

echo "<tr>
    <td colspan='6'><div align='right'><a href=''></a>
      <label>
      <input type='submit' name='Submit' value='Submit' />
      </label>
    </div></td>
  </tr>
</table>";
?>

can it be done? or is there another way? pls help me.


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.