Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-24-2011, 07:59 PM   PM User | #1
rpjd
Regular Coder

 
Join Date: Apr 2007
Posts: 123
Thanks: 1
Thanked 0 Times in 0 Posts
rpjd is an unknown quantity at this point
Passing an array to POST

I'm submitting a form with with table structure:
Code:
<table method="POST" action="file.php">
<td><input type="checkbox" name="checkboxArray[]" value="xyz"></td>
<td><input type="text" value="x"></td>
<td><input type="text" value="y"></td>
<td><input type="text" value="z"></td>
<td name="textArray[]></td>
There are several table involved.
My problem is that when I try to access the arrays, only the checkboxArray is available/visible in $_POST. Does anyone have a solution?
rpjd is offline   Reply With Quote
Old 02-24-2011, 08:36 PM   PM User | #2
wldrumstcs
Regular Coder

 
Join Date: Jul 2009
Location: Chicago, IL
Posts: 169
Thanks: 26
Thanked 3 Times in 3 Posts
wldrumstcs is an unknown quantity at this point
You have to give the inputs names. Otherwise, you can't access them.
wldrumstcs is offline   Reply With Quote
Old 02-24-2011, 08:57 PM   PM User | #3
rpjd
Regular Coder

 
Join Date: Apr 2007
Posts: 123
Thanks: 1
Thanked 0 Times in 0 Posts
rpjd is an unknown quantity at this point
Sorry, the checkboxArray and textArray are the only values I need to access. Using array_key_exists() and empty() I can access checboxArray[], but having a problem with textArray. I think the problem is that I'm passing an array name and a value for each checkbox, I'm only passing an array name for the table cell text. How can I pass the text in the cell as an array element?
rpjd is offline   Reply With Quote
Old 02-24-2011, 10:42 PM   PM User | #4
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
Quote:
Originally Posted by rpjd View Post
How can I pass the text in the cell as an array element?
Options include

1) put a readonly textbox in the cell and the cell text in the textbox. Then give the textboxes the same or different names.

2) use javascript to copy the cell text to type="hidden" textboxes elsewhere in the form first before submitting the form. The hidden texboxes can have the same or different names.
bullant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:41 AM.


Advertisement
Log in to turn off these ads.