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.


In reply to CGI parameters are not set by awkmonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.