I have a bunch of table rows where each row will contain nested text inputs. The following are the name attributes for the possible inputs, which contain their own value in each row of the table:
answerAvalue = A answerBvalue = B answerCvalue = C answerDvalue = D answerEvalue = E ... //all the way to answerZvalue = Z answerTruevalue = True answerFalsevalue = False answerYesValue = Yes answerNovalue = No
Each row of the table also contains some switches located below:
<input type="radio" name="reply" />= = Single <input type="radio" name="reply" />= = Multiple
So, let's say I look at each row of the table and extract the values โโof each radio buttons selected in each row, then the code for this is below:
$i = 0; $c = count($_POST['gridValues']); //counts number of appended rows for($i = 0; $i < $c; $i++ ){ //for each loop which goes through each row switch ($_POST['reply'][$i]){ case "single": $selected_reply = "Single"; break; case "multiple": $selected_reply = "Multiple"; break; default: $selected_reply = ""; break; }
But what is my question is, since each text input has its own name attribute, then how can I write code to achieve the same as above, but explicitly for text inputs?
source share