isset(Checkboxname) returning true always


I am using 2 text boxes and 2 check boxes in my page. I just want to retrieve the values of that and i want to store it in a Database.

This is the code:


  <div class="row">


	<?php echo $form->textField($model,'uname'); ?>

	<?php echo $form->error($model,'uname'); ?>


<div class="row">




	<?php echo $form->passwordField($model,'password'); ?>

	<?php echo $form->error($model,'password'); ?>


    <div  class="row">

	<?php echo $form->checkBox($model,'prov_flag'); ?>

	<?php echo $form->label($model,'prov_flag'); ?>

	<?php echo $form->error($model,'prov_flag'); ?>


	<div  class="row">

	<?php echo $form->checkBox($model,'view_flag'); ?>

            <?php echo $form->label($model,'view_flag'); ?>

	<?php echo $form->error($model,'view_flag'); ?>


<div class="row">		

	<input type="submit" name="submit" value="Submit">


And i am using session variables to store the value.I was able to retrieve the username and password successfully. But while checking whether check box is checked there is a problem.

It always returns true.

And the code is,





When i try to print the value,

echo $_SESSION[‘prov’];

It always printing 1. whether it is checked are not.

I don’t know whether i did any mistake.If so,please anyone correct me.

help me please…

yes because is allways setted isset(checkbox) mean :

is my checbox in url seted ?

yes it is and returns true,because is setted in form;

Solution for you you need to check if my checkbox is not empty and not equal to 0:

if(!empty('checkboxname') && (checboxname != 0)){

//now do the rest thing



Thank u so much. Its working perfectly.