Insert dynamic checkboxes and corresponding textboxes value.
Posted: Thu Oct 18, 2007 2:19 am
feyd | Please use
When a user ticks a checkbox and enters data into the corresponding textbox and submits, the value of the checkbox and textbox should be inserted into the database. I can insert the checkbox values perfectly, but the textbox values have issues.
That code will only input the ticked checkbox values perfectly, but if i've ticked checkbox 1, 3 and 5 (of the dynamic checkboxes) it loops 3 times and will only insert values from TEXTBOX 1,2,3 INSTEAD OF 1, 3, 5.
Can anyone point me in the right direction here? Thankyou gentlemen.
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]
Hello.
I have some[size=150] dynamic checkboxes and corresponding textboxes[/size].
[syntax="html"]
<tr>
<td width="6%"><input name="service[]" type="checkbox" value="primary"></td>
<td width="32%" class="newsdate2">Primary</td>
<td width="62%"><input name="txt[]" type="text" value="" class="news_home" ></td>
</tr>
<tr>
<td><input name="service[]" type="checkbox" value="school"></td>
<td class="newsdate2">School</td>
<td><input name="txt[]" type="text" class="news_home" ></td>
</tr>
<tr>That code will only input the ticked checkbox values perfectly, but if i've ticked checkbox 1, 3 and 5 (of the dynamic checkboxes) it loops 3 times and will only insert values from TEXTBOX 1,2,3 INSTEAD OF 1, 3, 5.
Can anyone point me in the right direction here? Thankyou gentlemen.
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]