0
I need to mount an array like the one below:
$aDup = array(
array('carlos','2016-06-20','300.00'),
array('mario','2016-07-20','300.00'),
array('joao','2016-08-20','300.00'),
array('silvio','2016-09-20','300.00')
);
To fill out below so:
foreach ($aDup as $dup) {
$nDup = $dup[0];
$dVenc = $dup[1];
$vDup = $dup[2];
$resp = $nfe->tagdup($nDup, $dVenc, $vDup);
}
Receiving this data via POST
$nDup = $_POST['nDup'];
$dVenc = $_POST['nDup'];
$vDup = $_POST['nDup'];
Uploaded by this html this so:
<input name='nDup[]' type='text'>
<input name='dVenc[]' type='text'>
<input name='vDup[]' type='text'>
Why did you put
[ ]
in the input name attribute?– WMomesso
Because it is an array and can be repeated these INPUTS, for example, can have more than 1 or 2 inputs with name nDup, dVenc, vDup
– Alh
What is the real question? What difficulty are you encountering ?
– Isac
in case you create an array within another correct array ?
– user28266
tried it like this =>
<input name="nDup[duplicata][ ]">
?– WMomesso
Guys, if you can pay attention to the question, I’ve separated what I need to do, so I have inputs that can be repeated 1 or more times, depending on the number of duplicates, with name='nDup[]' dVenc[] and vDup[], I’m getting them via POST, and I need to create an array with these POSTS equal to this $aDup = array( array('mario','2016-07-20','300.00'), array('Joao','2016-08-20','300.00') ); Since mario is nDup, the date on the side is dVenc and the value is vDup
– Alh