hi guys,
i have a check box on my insert page which works fine.
but on my update page, how do i pull wheather it is checked or not out of the DB?
do you do write some code that checks if checkbox feild "yes" or "empty" then decided if checkbox is "checked" or not in html?
is that the correct way or is there a better way?
thanx
updating a checkbox [Solved]
Moderator: General Moderators
updating a checkbox [Solved]
Last edited by C_Calav on Wed Feb 16, 2005 11:05 pm, edited 1 time in total.
thanx feyd.
this works as in it updates correctly if the user checks it or not, but when the results are pulled out of the DB it always shows that the checkbox is checked, when sometimes in fact it isnt.
do i have something wrong here?
this works as in it updates correctly if the user checks it or not, but when the results are pulled out of the DB it always shows that the checkbox is checked, when sometimes in fact it isnt.
do i have something wrong here?
Code: Select all
<input type="checkbox" name="ud_P_Active" value="yes" checked="
<?php
if (!empty($P_Active))
{
echo "checked";
}
?>" />Hey
Maybe try something like this
Maybe try something like this
Code: Select all
<input type="radio" name="ud_P_Active" class="input-box" value="yes"<?php echo $_POSTї'ud_P_Active']=='yes' ? 'checked' : ''?>>