-2
I have the following code
foreach ($_POST['codmunicipio'] as $key => $valor2) {
$codmunicipio = $valor2;
$valor_ipl3_f = $_POST['IPL3_valor_F'];
$valor_ipl3_j = $_POST['IPL3_valor_J'];
$sql3 = "INSERT INTO financeiro_sici_anatel_ipl3 (ano, mes, fistel,codmunicipio, IPL3_valor_F, IPL3_valor_J)
VALUES ('$ano_upload', '$mes_uplooad', '$fistel','$codmunicipio', '$valor_ipl3_f', '$valor_ipl3_j')";
}
I’m trying to make sure that for each municipality code it takes a value f and j_
exemplo: codmunicipio 1
valor_f 20
valorj_ 30
codmunicipio 2
valor_f 10
valor_j 50
etc.
and then enter into a database.
any hint?
this information comes from the following page:
<?php
$id = 1;
while($dado_ipl3 = mysqli_fetch_array($qry_ipl3)) {
$id++;
$nome_municipio = $dado_ipl3['CIDADE'];
$codmunicipio = $dado_ipl3['COD_CIDADE'];
?>
<input type="hidden" name="id[]" value="<?php echo $id;?>">
<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
<div class="container">
<div class="row">
<label class="col-md-3">IPL3 Distribuição do quantitativo total de acessos fisícos em serviço por tipo de usuário (mensal)</label>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
<label class="col-md-3">Nome Município</label>
<div class="col-md-9 col-sm-6 col-xs-6 form-group has-feedback">
<input type="text" name="nome_municipio" id="nome_municipio" class="form-control" value="<?php echo"$nome_municipio" ?>" maxlength="18" size="18" title="Nome Município">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
<label class="col-md-3">Codigo Municipio</label>
<div class="col-md-9 col-sm-6 col-xs-6 form-group has-feedback">
<input type="text" name="codmunicipio[]" id="codmunicipio" class="form-control numero_livre" value="<?php echo $codmunicipio; ?>" maxlength="7" size="7">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
<label class="col-md-3">Acesso físico P.F.</label>
<div class="col-md-9 col-sm-6 col-xs-6 form-group has-feedback">
<input type="text" name="IPL3_valor_F[]" id="IPL3_valor_F" class="form-control numero" value="0" maxlength="18" size="18" title="Quantitativo de Acesso físico em serviço pelo tipo da Pessoa Física">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
<label class="col-md-3">Acesso físico P.J.</label>
<div class="col-md-9 col-sm-6 col-xs-6 form-group has-feedback">
<input type="text" name="IPL3_valor_J[]" id="IPL3_valor_J" class="form-control numero" value="0" maxlength="18" size="18" title="Quantitativo de Acesso físico em serviço pelo tipo da Pessoa Jurídica">
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
that
$_POST['codmunicipio']
is an array? What exactly is the problem? You are unable to insert?– Andrei Coelho
What you want is to enter these values at once?
– Andrei Coelho
Another thing.. These values are an array?
$valor_ipl3_f = $_POST['IPL3_valor_F'];
 $valor_ipl3_j = $_POST['IPL3_valor_J'];
?– Andrei Coelho
I posted the source page of the values. They are within a structure While...this is my difficulty. move to another page to enter all information in the database
– olifreitas
I think I understand... these values are numerical?
– Andrei Coelho
Yeah! They’re all numbers.
– olifreitas
If you have a municipality with you normally. but when you have several I cannot pass the values to another page.
– olifreitas
I get it... I’m analyzing it here. I’m going to formulate a response.
– Andrei Coelho
Thank you very much for your help.
– olifreitas