nodirtyrockstar Posted October 27, 2012 Share Posted October 27, 2012 (edited) 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 October 27, 2012 by nodirtyrockstar Quote Link to comment https://forums.phpfreaks.com/topic/269962-html-form-checkbox-and-text-inputs/ Share on other sites More sharing options...
Jessica Posted October 27, 2012 Share Posted October 27, 2012 (edited) 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 October 27, 2012 by Jessica Quote Link to comment https://forums.phpfreaks.com/topic/269962-html-form-checkbox-and-text-inputs/#findComment-1388060 Share on other sites More sharing options...
nodirtyrockstar Posted October 27, 2012 Author Share Posted October 27, 2012 I made a mistake elsewhere in my code! Thanks, your answer helped me find it. Quote Link to comment https://forums.phpfreaks.com/topic/269962-html-form-checkbox-and-text-inputs/#findComment-1388062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.