Jump to content
Saaantos

Manipulação de checkboxes

Recommended Posts

Saaantos

Neste codigo o que estou a fazer é criar checkboxes com todos os campos que se encontram na tabela 'temas'.

Quando faço faço 'criar evento' o que faz é ir buscar o id de UMA checkbox que tenha selecionado e mostrar o mesmo. Mas o que necessito é de vários ou seja se selecionar várias checkboxes preciso de todos os id's das mesmas.

  <form action="" method="post" class="niceform">
	  <?php if (isset($_POST['criar'])) {
if(!empty($_POST['$name'])) {

 echo $_POST['evento'];
}else{
 echo $_POST['evento'];
}}
?>
			<h2>Criar evento:</h2>
   </dl>
				  <dt> <h3>TESTE</h3></dt>	
   <dl>

					<?php
  $sql=sprintf("select * from temas order by id_tema asc");
  $res=mysql_query($sql);
  while ($reg=mysql_fetch_array($res)){
   $name= $reg['id_tema'];
   $desig= $reg['subtema'];
   ?>
   <input type="checkbox" name="evento" value="<?php echo $name ?>"><label><?php echo'.'?> <?php echo  $desig ?> </label><br>
   <?php
  }
  ?>
				<input type="submit" name="criar" id="criar" value="Criar evento" />
				 </dl>

	 </form>

Share this post


Link to post
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

×
×
  • 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.