Mo wrote:
Quote:
Newbie question: Is there a way to have an checkbox input define a
var?
I have a report for sales activity for a user definable date range.
>
I want to include a "Last Month" checkbox in my form section of the
page.
I already have the code to create the dates for this, but am hoping to
use an IF/ELSE with the checkbox to automatically populate the input
text boxes IF the box is checked.
>
Any common or creative ways to achieve this?
>
~Mo
>
No. An unchecked checkbox will not send it's data to the server.
What you can do is something like:
if (isset($_POST['mycheckbox'])) {
... stuff here ...
assuming the form is POSTed to the server and the checkbox is named
'mycheckbox', of course.
You can even take this one further:
if (isset($_POST['mycheckbox']) && $_POST['mycheckbox'] = 'myvalue') {
This not only tests to see if the checkbox is set, but verifies the
value in the checkbox is 'myvalue'.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================