html is not sending images to the server

Asked

Viewed 55 times

0

I have the following modal:

    <!-- MODAL PARA CADASTRO DE TAMANHOS -->
    <div class='modal fade' id='modalTamanho' tabindex='-1' role='dialog' aria-labelledby='myModal'>
    <div class='modal-dialog' role='document'>
    <div class='modal-content'>
    <div class='modal-header'>
    <button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button>
    <h4 class='modal-title' id='myModalLabel'>Cadastro de tamanhos</h4>
  </div>
  <div class='modal-body'>
      <form id='tamanho' name='tamanho' method='post' enctype='multipart/form-data'>
        <label>Componente : </label>
        <select class='form-control componente' id= 'selectComponentes' name='selectComponentes'>
              <?php
                $query = ("select id_principal from componentes,aparelhos where componentes.id_secundario = ".$_POST['selectTamanho']." and aparelhos.id = ".$_POST['selectTamanho']." ");
                $max = mysqli_query($con,$query);
                while ($i = mysqli_fetch_row($max))
                {
                  $query = ("select id_principal,nome from componentes where id_principal = ".$i[0]." ");
                  $aparelho = mysqli_query($con,$query);
                  $fetch = mysqli_fetch_row($aparelho);
                  $id = $fetch[0];
                  $nome = $fetch[1];
                  print "<option value='".$id."'>".$nome."</option>";
                }
              ?>
      </select>
      <div class='form-group'>
      <label>Entrada : </label>
      <input type='text' class='form-control' id='labelEntrada' name='labelEntrada'>
      </div>
      <div class='form-group'>
      <label>Saída : </label>
      <input type='text' class='form-control' id='labelSaida' name='labelSaida'>
      </div>
      <div class='form-group'>
      <label>Quantidade F: </label>
      <input type='text' class='form-control' id='labelQuantidadef' name='labelQuantidadef'>
      </div>
      <div class='form-group'>
      <label>Quantidade M: </label>
      <input type='text' class='form-control' id='labelQuantidadem' name='labelQuantidadem'>
      </div>
      <div class='form-group'>
      <label>Quantidade G: </label>
      <input type='text' class='form-control' id='labelQuantidadeg' name='labelQuantidadeg'>
      </div>
    <div class='form-group'>
      <label>Quantidade GG: </label>
      <input type='text' class='form-control' id='labelQuantidadegg' name='labelQuantidadegg'>
    </div>
    <div class='form-group'>
      <label>Foto do componente : </label>
      <input id='fotoComponente' name='fotoComponente' type='file'>
    </div>
    <div class='form-group'>
      <label>Foto do acabamento : </label>
      <input id='fotoAcabamento' name='fotoAcabamento' type='file'>
    </div>
    <div class='form-group'>
      <label>Foto da máquina : </label>
      <input id='fotoMaquina1' name='fotoMaquina1' type='file'>
    </div>
    <div class='form-group'>
      <label>Foto da máquina : </label>
      <input id='fotoMaquina2' name='fotoMaquina2' type='file'>
    </div>
    <button type='submit' class='btn btn-success'>Gravar</button>
    </form>
  </div>
  <div class='modal-footer'>
  <button type='button' class='btn btn-danger' data-dismiss='modal'>Sair</button>
  </div>
</div>  
</div>
</div>

But when I try to use the post to check if the variable was filled in with php, php accuses that the variable is empty.

  • integer id

  • Where it’s coming from $_POST['selectTamanho'] ? And what the action form ? In what way you are sending the data, because I only see the select ?

  • The problem was already solved I was using $_POST instead of $_FILES

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.