Jump to content

Preenchimento input checkbox


Lisboeta
 Share

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.