Pesquisar na Comunidade
Mostrando resultados para as tags ''array sem indice''.
Encontrado 1 registro
-
Estou com o seguinte problema eu tenho uma tabela no php com imagens e um check box ai quando eu seleciono as imagens no checkbox elas enviam o nome da imagem pra uma outra pagina php que deveria comparar um array vindo do banco de dados com esse da outra pagina porem quando eu puxo esse array da outra pagina ele vem sem os índices. ph =================== <?php $id=$_GET['id']; //print_r($id); $res = mysqli_query($connect,"SELECT * FROM projetos WHERE id='$id'"); $projetos = mysqli_query($connect,$res); echo' <!-- Main --> <div id="main"> <!-- Featured Post --> <section class="posts"> <center><table borde=0> <form enctype="multipart/form-data" action="php_scripts/update_valores.php" method="post" name="formulario"> '; $z=0; while($escrever=mysqli_fetch_array($res)) { $meuarray = explode(',',$escrever["imagem"]); $contador=count($meuarray); $categoria = strtolower($escrever["categoria"]); //echo '../../imagens/projetos/'.$categoria.'/'.$escrever["cliente"].'/'.$meuarray[$y]; //print_r($meuarray); //print_r($whille); echo ' <article> <center><header> <h2> <textarea name="cliente" id="cliente">'.$escrever["cliente"].'</textarea> </h2> <textarea name="descricao" id="descricao">'.$escrever["descricao"].'.</textarea> </header></center> '; $z==0; for($y=0;$y<$contador;$y++) { $z++; if($y % 3 == 0 || $y==0) { echo'<tr>'; } echo ' <td> <input type="checkbox" class="form-check-input" name="checkbox['.$meuarray[$y].']" id="checkbox['.$meuarray[$y].']"> <label for="checkbox['.$meuarray[$y].']"> <img src="../../imagens/projetos/'.$categoria.'/'.$escrever["cliente"].'/'.$meuarray[$y].'" width="320" height="205" alt="" data-toggle="modal" data-target="#exampleModal" /> </label> </td>'; if($z==3) { echo'</tr>'; $z==0; } } echo ' </table> </center> </article> <center> <button class="btn btn-inverse" onClick="history.go(-1)" style="padding-top:0px; padding-bottom:0px"> Voltar <span class="glyphicon glyphicon-arrow-right"></span> </button> <button class="btn btn-inverse" style="padding-top:0px; padding-bottom:0px" formaction="deleta_imagens.php" method="POST"> Excluir Imagem <span class="glyphicon glyphicon-arrow-right"></span> </button> <button class="btn btn-inverse" onClick="history.go(-1)" style="padding-top:0px; padding-bottom:0px"> Adicionar Imagem <span class="glyphicon glyphicon-arrow-right"></span> </button> <button class="btn btn-inverse" onClick="return confirmacao();" style="padding-top:0px; padding-bottom:0px"> Salvar <span class="glyphicon glyphicon-arrow-right"></span> </button> </center> <script language=javascript> function confirmacao() { if (confirm("Voce quer mesmo substituir as informações?")) document.formulario.submit(); } </script> </form> '; } ?> ================================ Deleta Imagem ================================ <?php require "../../php_scripts/connect.php"; //require '../../php_scripts/init.php'; //require '../../php_scripts/check.php'; $check[]=$_POST['checkbox']; $cliente=$_POST['cliente']; $str = implode(',', $_POST['checkbox']); print_r ($check); //echo $check; echo '<br><br>'; /*$input = array("item 1", "item2", "item3", "item4"); $remover = array("item2"); $resultado = array_diff($input, $remover); echo "<br><br>AQUI<br>"; print_r ($resultado);*/ $res = mysqli_query($connect,"SELECT * FROM projetos WHERE cliente='$cliente'"); while($escrever=mysqli_fetch_array($res)) { $meuarray = explode(',',$escrever["imagem"]); $contador=count($meuarray); } echo "<br><br>AQUI<br>"; print_r ($meuarray); print $meuarray[2]; echo "<br><br>AQUI<br>"; $resultado = array_diff($meuarray, $check); print_r ($meuarray); ?>
- 1 resposta