Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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?

 

Thanks.

#!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="temp.pl"> <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.

Comment on CGI parameters are not set
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://243923]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-10-21 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (100 votes), past polls