I have dynamic inputs with names my_image[url]
and my_image[caption]
<input name="my_image[url]" type="hidden" value="<?php echo $imgurl['url'];?>"/>
<input name="my_image[caption]" type="text" value="<?php echo $imgurl['caption'];?>">
Even when inserting several images and captions dynamically, within isset $ _POST ['my_image']
is capturing only 1 image and 1 caption:
if (isset($_POST['my_image'])){
update_option('imagens_inicio',array($_POST['my_image']);
echo '<pre>'; var_dump($_POST['my_image']);echo '</pre>';
}
array(1) {
[0]=>
array(2) {
["url"]=>
string(96) "http://localhost/theme/wp-content/uploads/2017/08/4e07dd2bd752b989e9b4687129982977.jpg"
["caption"]=>
string(0) "test text"
}
}
How do I make the array to be created in a continuous sequence:
url[]
caption[]
url[]
caption[]
Thank you for your help