Jump to content

Insert checkbox val + textbox val into db


somedude

Recommended Posts

Hello.

I have some dynamic checkboxes and corresponding textboxes.
[code]while($row=mysql_fetch_array($resu­lt2))
{

<td ><br/><br/><inpu­ t type="checkbox" name="valhere[]" value="<? echo $row[dec]; ?>"><? echo $row[dec]; ?></p></td>
<td width="53%" colspan="8"><input name="varv[]" value="" >[/code]


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.

[code]
while (list ($key,$val) = @each ($dec)) {
list ($key,$val2) = @each ($varv);
[/code]

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.