1
I need to create multiple Ivs inside a foreach in my view, so far so view:
<?php
echo form_open('admin/marcacao/registraMarcacoes');
?>
<div class="area-imagem">
<img src="<?= $img?>" alt="<?= $img?>">
<input style="display:none;" name="idImg" value="<?= $id?>">
<?php foreach ($marcacoes->result() as $row) : ?>
<div class="pixel" style="top:<?php echo $row->coordX ?>px; left:<?php echo $row->coordY ?>px"></div>
<?php endforeach ?>
</div>
<input style="display:none;" type="submit" class="btn btn-primary btn-lg my-5 mx-5" value="Registrar">
<?php
echo form_close();
?>
My controller is like this:
function insereMarcacoes()
{
$dados['img'] = $this->input->post('src');
$dados['id'] = $this->input->post('id');
$this->load->model('admin/tbdmarcacao');
$dados['marcacoes'] = $this->tbdmarcacao->listaMarcacoes();
$this->load->view('admin/inserir_marcacoes', $dados);
}
And my model this way:
function listaMarcacoes()
{
$id['idImagem'] = $this->input->post('id');
$query = $this->db->select('*')
->from('tbdmarcacao')
->where('idImagem', $id)
->get();
return $query->result_array();
}
The problem is that it is returning several errors, as shown in this print: