Jump to content

Retrieving checkboxes values from mysql

- - - - -

  • Please log in to reply
2 replies to this topic

#1
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
Hi All,

I have been able to insert a checkbox value into my database. The problem i am now facing is how to retrieve the value of the checkbox in the form of TICK.

Your help will be much appreciated.

Regards.

#2
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
well to make a check box pre-selected you do : <input type="checkbox" name=myBox value="value" checked>


So you want to alter the state of checked . To do that you will use a if statement.

if($myChecks['check'] == true)
   {
      $checked = "checked";
   }
 

than when you write that line again:

<input type='checkbox' name=mybox value='value' <?php echo $checked; ?> >


Posted Image

#3
webcodez

webcodez

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
EDIT: nvm, remove this post please (zeroradius has offered the correct solution).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users