I have a dynamic form for creating chapters and sub-chapters that create an array:
var_dump ($ _ POST);
array{["textfield"] => array {
[0] => "title one"
[1] => "title two"
[2] => "title three"
[4] => "title four"
}
["textarea"] => array {
[0] => "title text"
[1] => "title summary"
[2] => "title description"
[4] => "title details"
}
["hidden"] => array {
[0] => "1"
[1] => "2"
[2] => "3"
[4] => "1"
}
}
I am very weak with arrays. I read several articles on multidimensional arrays and sorting, but havent been lucky or have seen examples similar to mine enough to understand how I need to adjust this.
I would like for everyone:
<div class="row<? echo $hidden ?>">
<h2><? echo $textfield ?></h2>
<h3><? echo $textarea ?></h3>
</div>
which corresponds to key 0 (or the corresponding key number) and value through several arrays. Similar to:
<div class="row<? echo $_POST['hidden'][0] ?>">
<h2><? echo $_POST['textfield'][0] ?></h2>
<h3><? echo $_POST['textarea'][0] ?></h3>
</div>
<div class="row<? echo $_POST['hidden'][1] ?>">
<h2><? echo $_POST['textfield'][1] ?></h2>
<h3><? echo $_POST['textarea'][1] ?></h3>
</div>
<div class="row<? echo $_POST['hidden'][2] ?>">
<h2><? echo $_POST['textfield'][2] ?></h2>
<h3><? echo $_POST['textarea'][2] ?></h3>
</div>
<div class="row<? echo $_POST['hidden'][3] ?>">
<h2><? echo $_POST['textfield'][3] ?></h2>
<h3><? echo $_POST['textarea'][3] ?></h3>
</div>
This form can be dynamically created in hundreds of depths, and I was able to print the entire array or all the $ values for each key $. Ive not succeeded in various arrays.
I hope you go. If you have any suggestions, I will be very grateful.
Tommy source
share