Click to See Complete Forum and Search --> : Sending 0 instead "" when unchecked


Perfidus
12-11-2003, 10:14 AM
I have a collection of radio buttons that have to send several values via post to database. When they are checked, they send the value but when they are unchecked, they send "" (nothing) and it is stored in table (In which default content was 0) this cause me troubles.
How can I send alternative value 0 when unchecked or how can I prevent this bull****?
:(

pyro
12-11-2003, 02:26 PM
How about ripping through the $_POST array and setting all values that equal "" to 0?

for($i=0; $i<count($_POST); $i++) {
if ($_POST[$i] == "") {
$_POST[$i] = 0;
}
}