Jump to content

checkbox values


psuplat

Recommended Posts

Hi everyone,

I'm facing a problem when submiting checkboxes values to db.

 

On form a have 3 checkoxes titled Visual, Functional, Data.

 

They will relate to the db table fields: visual, functional, data

 

In db those fields are set to YES/NO values.

 

When the user ticks the checkbox, it's value is being posted ($_POST['f_visual']="YES").

But when the checkbox has not been ticked, it is not being posted at all.

Now, I know that this is correct from HTML point of view, as element not checked doesn't need posting, but how can I make the unchecked textbox post "NO" value.

 

I've tried many different ways to go around it: for one - setting default value of $_POST['f_visual'] as "NO" on first page at the begining of the sesion,

other approach - on page that controls post actions I set variable $t_visual to "NO", then using if isset I checked if $_POST['f_visual'] existed. if so I did $t_visual = $_POST['f_visual']., plus many other approaches.

Nothing works,

any ideas how to do it?

Link to comment
https://forums.phpfreaks.com/topic/207130-checkbox-values/
Share on other sites

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.