Re: Multiple checkboxes and multiple textboxes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You're close, but you want to use multidimensional arrays. So something like:
<input type=checkbox name=data[0][url] value='http'>
<input type=text name=data[0][txt] size=75 value='desc'>
<input type=checkbox name=data[1][url] value='http'>
<input type=text name=data[1][txt] size=75 value='desc'>
<input type=checkbox name=data[2][url] value='http'>
<input type=text name=data[2][txt] size=75 value='desc'>
...


Obviously you can put that into a loop to generate how many you want instead of typing each one individually. It will then be simple to match your array items since your array will have x rows and two columns: url, txt. Just keep in mind that some rows rows will have two columns and some one, depending on if they filled out both fields.

On Nov 5, 2004, at 2:28 PM, Ryan A wrote:

Hi,
I have a form that has something like this:

<input type=checkbox name=url[] value='http://somesite' checked>
<a href='http://somesite' target=a>somesite</a>
<br><input type=text name=txt[] size=75 value='some desc'>

<input type=checkbox name=url[] value='http://somesite1' checked>
<a href='http://somesite1' target=a>somesite1</a>
<br><input type=text name=txt[] size=75 value='some desc1'>

<input type=checkbox name=url[] value='http://somesite2' checked>
<a href='http://somesite2' target=a>somesite2</a>
<br><input type=text name=txt[] size=75 value='some desc2'>

As you can see from the above, theses a checkbox (url[]) which holds the
value of the URL and a textbox (txt[]) which holds some description text, in
the above there are only 3 rows but actually there are 200 per page. When
the form is submitted how do I make sure that if url[] is unchecked even
txt[] should not be taken?


These values will be entered into the database so I need proper "matching
pairs" of URL and TXT


Thanks,
Ryan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux