Hi,
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:
(index.php)
<div class="row">
Username:
<?php echo $form->textField($model,'uname'); ?>
<?php echo $form->error($model,'uname'); ?>
</div><br>
<div class="row">
Password:
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div><br>
<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>
<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>
<div class="row">
<input type="submit" name="submit" value="Submit">
</div>
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,
session_start();
$_SESSION['cuname']=$this->uname;
$_SESSION['cpasswd']=$this->password;
$_SESSION['prov']=isset($this->prov_flag);
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…