PHP Classes

Checkbox problem

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  Checkbox problem  >  (Un) Subscribe thread alerts  
Subject:Checkbox problem
Summary:How to post checked boxes
Messages:2
Author:Bjarki M. Karlsson
Date:2008-07-14 21:57:43
Update:2008-07-15 00:39:22
 

  1. Checkbox problem   Reply   Report abuse  
Picture of Bjarki M. Karlsson Bjarki M. Karlsson - 2008-07-14 21:57:43
This class is a wonderful thing. Thanks!
However, I can't send information on checkboxes that are ckecked.
My code reads:
$arguments["PostValues"]=array(
"searchphrase"=>$_POST['searchphrase'],
"searchlanguage"=>$_POST['searchlanguage'],
"targetlanguage"=>$_POST['targetlanguage'],
"cbMALFR"=>"on",
"cbRETTRITUN"=>"on",
"cbTUNGUTAEKNI"=>"on",
);
The request body is:
searchphrase=fall&searchlanguage=IS&targetlanguage=&cbMALFR=on&cbRETTRITUN=on& cbTUNGUTAEKNI=on

The first three fields show perfectly up in the receiving application, BUT - it does not recognize the last three, which are of type checkbox.

However, if I use the input form of the web site I am submitting to (checking the relevant boxex), everything if OK.

I have tried =1 and =true instead of =on but no luck.

Hope you can help me.

B.M.Karlsson, Iceland

  2. Re: Checkbox problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-07-15 00:39:22 - In reply to message 1 from Bjarki M. Karlsson
The default value for checked checkbox fields is On . If the checkbox is unchecked, it does not not appear in the posted values.