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

enter image description here

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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -