Jump to content


Photo

foreach statement and submit


  • Please log in to reply
No replies to this topic

#1 Zyncmaster2006

Zyncmaster2006
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 05 September 2006 - 03:50 AM

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.







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users