php - group data of multiple fields in an array -
i have hidden input values each module see in following html. once data posted, how can data of each module in array, can store it.
<div class="module">module1</div> <input type="hidden" value="module1" name="module_id"> <input type="hidden" value="title" name="title"> <input type="hidden" value="some text" name="text"> <div class="module">module2</div> <input type="hidden" value="module2" name="module_id"> <input type="hidden" value="another title" name="title"> <input type="hidden" value="another text" name="text">
i unable understand how combine title , text input module id.
put []
after names. php turn them each array.
<div class="module">module1</div> <input type="hidden" value="module1" name="module_id[]"> <input type="hidden" value="title" name="title[]"> <input type="hidden" value="some text" name="text[]"> <div class="module">module2</div> <input type="hidden" value="module2" name="module_id[]"> <input type="hidden" value="another title" name="title[]"> <input type="hidden" value="another text" name="text[]">
now you'll have arrays $_post['module_id']
, $_post['title']
, , $_post['text']
can iterate over.
Comments
Post a Comment