I have the following 2 tables:
-- members --
|member_ID|nick_name|
---------------------
| 1 | Jack |
---------------------
| 2 | Jill |
---------------------
-- shares --
|member_ID|nick_name|percent_owner|
-----------------------------------
| 1 | Jack | 75 |
-----------------------------------
| 2 | Jill | 25 |
-----------------------------------
My first php page will query the members table and create an html table just fine. In the html table, I added a blank text box to manually enter the percent owner value. This is what that table looks like:
<table>
<?php foreach ($members as $members) : ?>
<tr>
<td><?php echo $members['member_ID']; ?></td>
<td><?php echo $members['nick_name']; ?></td>
<td><input type="text" name="percent_owner[]" value="" size="3"></td>
</tr>
<?php endforeach; ?>
</table>
Now, what I am trying to do is send the new information to another page to create another html table with the member_ID, nick_name, and percent owner. This where my problem lies. Here is the 2nd html table:
<table>
<?php foreach ($members as $member) : ?>
<?php foreach ($_POST['percent_owner'] as $value) : ?>
<tr>
<td><?php echo $member['member_ID']; ?></td>
<td><?php echo $member['nick_name']; ?></td>
<td><?php echo $value; ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
I don't believe I am organizing my foreach statements properly. Either I get only the first percent_owner value in every row, or I get both in each row, but cannot get it right. Once I have this figured out, I will then enter it all into the shares table but that will come later. I need to tackle this first.
thank you!