"Your suggestion looks like the last one of mine above, but with 'off' instead of 'on'. Are you suggesting that setting it to 'off' will check the checkbox?"

Precisely.

Given the following form:

<form action="foo.cgi" method="post"> <input name="foo" value="off" type="checkbox"> </form>

Then when the checkbox is ticked, the string foo=off will be posted to the server. When the checkbox is blank, then the empty string is posted to the server. The string "off" doesn't have any significance to the HTML form. If doesn't mean false, or unticked, or anything. It's just a three-character string that will be posted to the server as the value for the "foo" input when that input has been ticked.

"I'm guessing that this problem may be caused by the '%' in the element name"

That may well be the cause. Normally when a form input name contained an "@" I'd expect the HTML itself to contain a plain "@" (or perhaps HTML-escaped as &#x40; or &#64;). The escaping as '%40' would happen when the form was submitted and encoded as application/x-www-form-urlencoded. There might be some double-encoding happening at some stage.

I suggest taking a look with Wireshark or similar to compare what data LWP::UserAgent is posting compared to what a desktop browser posts.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

In reply to Re^3: Unable to check checkbox via LWP::UserAgent by tobyink
in thread Unable to check checkbox via LWP::UserAgent by tel2

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.