iterate through form elements
Posted: Wed Oct 25, 2006 2:04 pm
feyd | Please use
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have the following Form Elements. I need to grab which row is checked, and the display the appropriate information on the screen. So, if chk with value 1 and 3 are checked, I want to grab the associated values and display them to the screen? How could I accomplish this with PHP? I think a foreach, but I am not getting the syntax right. Any help is appreciated . Thanks alot
[syntax="html"]<tr>
<td><input checked=checked type=checkbox name='chk' value='1'></td>
<td><input type=hidden name='title_1' value=''></td>
<td><input type=hidden name='fname_1' value='Andrew'>Andrew</td>
<td><input type=hidden name='lname_1' value='Akins'>Akins</td>
<td><input type=hidden name='taxid_1' value='xxxxxxxx'>260635446</td>
<td><input type=hidden name='lastlogon_1' value='10/25/2006''>10/25/2006</td>
<td><input type=hidden name='username_1' value='aakins@smcvt.edu'>aakins@smcvt.edu</td>
<td><input type=hidden name='password_1' value='aakins'>aakins</td>
<td><input type=hidden name='mname_1' value=''> </td>
<td><input type=hidden name='active_1' value='true'>true</td>
<td><input type=hidden name='suffix_1' value=''></td>
<td><input type=hidden name='status_1' value='1'>1</td>
<td><input type=hidden name='inserted_1' value='oppExport'>oppExport</td>
</tr>
<tr>
<td><input checked=checked type=checkbox name='chk' value='2'></td>
<td><input type=hidden name='title_2' value=''></td>
<td><input type=hidden name='fname_2' value='Albert'>Albert</td>
<td><input type=hidden name='lname_2' value='Battista'>Battista</td>
<td><input type=hidden name='taxid_2' value='xxxxxxxx'>579648564</td>
<td><input type=hidden name='lastlogon_2' value='10/25/2006''>10/25/2006</td>
<td><input type=hidden name='username_2' value='albattista12@comcast.net'>albattista12@comcast.net</td>
<td><input type=hidden name='password_2' value='abattista'>abattista</td>
<td><input type=hidden name='mname_2' value=''> </td>
<td><input type=hidden name='active_2' value='true'>true</td>
<td><input type=hidden name='suffix_2' value=''></td>
<td><input type=hidden name='status_2' value='1'>1</td>
<td><input type=hidden name='inserted_2' value='oppExport'>oppExport</td>
</tr>
<tr>
<td><input checked=checked type=checkbox name='chk' value='3'></td>
<td><input type=hidden name='title_3' value=''></td>
<td><input type=hidden name='fname_3' value='Andrew'>Andrew</td>
<td><input type=hidden name='lname_3' value='Burnett'>Burnett</td>
<td><input type=hidden name='taxid_3' value='xxxxxxxx'>049587706</td>
<td><input type=hidden name='lastlogon_3' value='10/25/2006''>10/25/2006</td>
<td><input type=hidden name='username_3' value='burnetteandrew@netscape.net'>burnetteandrew@netscape.net</td>
<td><input type=hidden name='password_3' value='aburnett'>aburnett</td>
<td><input type=hidden name='mname_3' value=''> </td>
<td><input type=hidden name='active_3' value='true'>true</td>
<td><input type=hidden name='suffix_3' value=''></td>
<td><input type=hidden name='status_3' value='1'>1</td>
<td><input type=hidden name='inserted_3' value='oppExport'>oppExport</td>
</tr>feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]