I have a bunch of checkboxes on the page and i want to pass two values for each checkbox like this….any idea how to get first_value and second_value past to the $_POST in php any suggestions on how to do this………………………………………… You can do …
via HTML Language Development » Search Results » ajax:
is there a way to pass two values in an input checkbox to th
I have a bunch of checkboxes on the page and i want to pass two values for each checkbox like this….
any idea how to get first_value and second_value past to the $_POST in php
any suggestions on how to do this
…………………………………………
You can do this
where you separate the two values by a : or whatever other separator you want.
Then on the $_POST you can use explode in a loop like this
pieces = explode(“:”, $class);
echo $pieces[0]; // CIS 2910C DL
echo $pieces[1]; // 3so you can pull out both values
…………………………………………
How about:
Then in PHP
foreach($_POST[‘class’] as $first_value=>$tmpArray)
foreach($tmpArray as $second_value)
echo $first_value.”: “.$second_value;
}Odd way of doing it, but its seems like an odd situation you are in anyways.
…………………………………………
I think you can only do this if you use ajax, or if you add a hidden field with an index sequential ‘[]‘ buying the checkbox with the value of X in X location hidden
…………………………………………
You can’t do it directly. I’d loop through with jquery and create new hidden inputs with those values and delete the data attr.
For more info: is there a way to pass two values in an input checkbox to th
HTML Language Development » Search Results » ajax