Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

CGI parameters are not set

by awkmonk (Monk)
on Mar 18, 2003 at 09:42 UTC ( #243923=perlquestion: print w/replies, xml ) Need Help??
awkmonk has asked for the wisdom of the Perl Monks concerning the following question:

Ah gracious monks,

I must be missing something, but I 've had a look around and can't find anything on this. I'm trying to read the value of a checkbox on a form. When it's checked, I can print out the value, but when I uncheck it and re-submit, I don't have a value.

The plan was to hold this value (along with a few others) in a cookie so that I can correctly default settings on the page.

The question is, how do I find the value of an unchecked box?



#!c:\perl\bin\perl -w BEGIN { $|=1; use CGI::Carp('fatalsToBrowser'); } use strict; use CGI qw(:standard); my $x = new CGI; print $x->header; print param('TB'); print <<EOF; <form method="POST" action=""> <p> <input type="checkbox" name="TB" value="ON" checked=0> check</p> <p> <input type="submit" value="Refresh" name="BRef"></p> </form> EOF ;

Awkmonk - dipping his toe in the Ocean of Perl.

Replies are listed 'Best First'.
Re: CGI parameters are not set
by zby (Vicar) on Mar 18, 2003 at 10:00 UTC
    You can't. It is not sent by browser.

      Ah, Sorry. A little light bulb has just come on. I should be checking that the submit button was clicked and therefore default to the value (or absence) of the checkbox.

      Why do things always look easier once you've posted the question.


      Thanks for putting up with me.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://243923]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2018-04-19 20:36 GMT
Find Nodes?
    Voting Booth?