Jump to content

Regarding checkbox values....If checked=true and for false


suaveshiva

Recommended Posts

Hi frd's,

While using checkbox....

if i check the textbox and submit the value i want Yes option into my database,

ok,am getting by placing the value="YES",

similarly if i uncheck, am not getting any uncheck values..

so how 2 add "No" in the database,if the checkbox is unchecked?....

I tried by giving thru default value in the database(MYSQL),but am unable 2 get "NO"..........

Is their any other solution?

 

plz suggest

 

Thank U inadvance.....

Suave shiva

try something like

<?php

$checkbox = $_POST['namecheckboxhere'];

if ( $checkbox == "Yes") 
    {
         insert mysql information here 
   }

  else {
    $checkbox = "No";

     insert mysql information hre;

}


 

I dunno about security issues but that should work

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.