php - How to do HTML array input with like this? -
i have laravel code loop , sample inputs
<input type="hidden" value="{{ $question['question'] }}" name="custom_form[question][{{ $question['name'] }}]" /> <input type="text" name="custom_form[answer][{{ $question['name'] }}]" /> and result
any idea how result?
array ( ( [immigration_status] => array ( [question] => current immigration status? [answer] => naturalized citizen ) [green_card] => array ( [question] => have green card? [answer] => yes ) .... ) ) if there no on <input>, how on foreach loop result this?
what current immigration status? naturalized citizen
have green card? yes
i foreach on 1 array have since keys match both questions , answers. can reference key of other array current value
foreach($_post['custom_form']['question'] $key => $question) { echo htmlentities($question . ' ' . $_post['custom_form']['answer'][$key]) . '<br>'; } 
Comments
Post a Comment