Hi Everyone,
Let's say I have this snippet of code for a checkbox:
input type=checkbox name=bill
$name = param('bill');
If the box is checked, $name will have a value of on
If the box is NOT checked, $name will be undefined (have no value).
My Question:
Is there a way to make $name have a
No, the fact that unchecked boxes aren't sent is a browser issue. It's the
same reason why submit buttons that are not clicked are undefined as well
on a multi-submit form.
What you can do, however, is use other form fields in combination with
logic. For example, let's say the name of your
try
$name = param('bill') || 'off';
a better answer might be forthcoming if you explained why you want to have this value
set.
Simon K. Chan wrote:
Hi Everyone,
Let's say I have this snippet of code for a checkbox:
input type=checkbox name=bill
$name = param('bill');
If the box is