Lisboeta Posted March 21, 2015 at 02:54 PM Report Share #579925 Posted March 21, 2015 at 02:54 PM Boas pessoal, Tenho a seguinte dúvida. Eu quero editar um formulário e que no qual eu queria que aquelas que foram seleccionadas aparece já preenchido , so que no codigo que segue em baixo na linha que está seleccionada a vermelho eu coloquei "if(isset(........)...." e depois experimentei assim com "if(!empty(......)......" em vez de me seleccionar só que está inserdo na BD selecciona todos. Será que estou a fazer algo mal?? Será que é por causa de estar dentro de um foreach?? <?php foreach ($marcas as $logos){?> <div id="logo_list" class="col-sm-4 col-md-3"> <table width="100%"> <tr> <td align="center"> <div style="height:90px; width:100%;"> <img src="<?=MARCAS2.$logos['imagem']?>" alt="<?=$logos['nome']?>" width="100%" height="80px"> </div> </td> </tr> <tr > <td align="center"> <input type="checkbox" name="checklogo[<?=$logos['id_marcas']?>]" value="<?=$logos['id_marcas']?>" <?php if(!empty($edit_catmarcas['id_marcas'])){ echo "checked";}?> style="margin-bottom:20px"> </td> </tr> </table> </div> <?php }?> Cumprimentos, Lisboeta Link to comment Share on other sites More sharing options...
Th3Alchemist Posted March 23, 2015 at 02:32 PM Report Share #580049 Posted March 23, 2015 at 02:32 PM (edited) O que retorna $edit_catmarcas['id_marcas']? Experimenta com: <input type="checkbox" name="checklogo[<?=$logos['id_marcas'];?>]" value="<?=$logos['id_marcas'];?>" <?=$edit_catmarcas['id_marcas'] ? 'checked="checked" : ''; ?> style="margin-bottom:20px"> Edited March 23, 2015 at 02:32 PM by Th3Alchemist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now