Jump to content

Recommended Posts

I have a table contained by a form. Each row of the table contains the following data cells:

<td>
<input type='text' name='cart[ccr-01-002]' size='2' />
</td>
<td>
<input type='checkbox' name='delete[ccr-01-002]' />
</td>

 

Rather than returning whether or not the checkbox is checked (such as ON or OFF), it is instead returning the value of the text input field. Here is how I am trying to reference it:

 

var_dump($_POST['delete']);

 

This prints out the string contents of the text fields instead of ON or OFF. Is it possible (without having to put the checkbox into its own form) to reference the checkbox as a separate entity from the text input? I would like to reference $_POST['cart'], and not have it affect $_POST['delete'].

 

Please let me know if you need any other information!

Edited by nodirtyrockstar
Link to comment
https://forums.phpfreaks.com/topic/269962-html-form-checkbox-and-text-inputs/
Share on other sites

Give both of them a value.

 

Since they have different names, they will have different values. What you're describing doesn't make any sense, and you haven't shown any proof of it.

 

Edit: Do you think 'ccr-01-002' is the value? It's not. It's an array key. What you get when you print_r or var_dump your arrays is a bunch of keys with empty values.

Edited by Jessica
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.