Gossamer Forum
Skip to Content



Home : General : Perl Programming :

Is this possible?

Quote Reply
Is this possible?
I've been wondering about a thing.
On a page I got one checkbox.
But how can the script read if it's marked or not?

Is this possible?

@getemail = ("yes");

print <<EndHdr;
<html><head><title>My page</title></head>
<body bgcolor=$bgcolor text=$text link=$link>
<center> <h2>Thank you!</h2> </center> <p>
Thanks for your comment.<br>

EndHdr

foreach $x (@getemail) {
if ($FORM{$x} == 1) {
print "You marked.\n";
}
}

print <<EndFooter;
Here's the footer!<br>
<a href=\"index.html\">home page</a>
</body></html>

EndFooter


???

Just wondering...
Quote Reply
Re: [perlman] Is this possible? In reply to
Anything is possible but you have to want it to happen.

Your post does not give sufficient information to assimilate your request.

Please comply.

We are of borg checkboxes version 2, we do not need perl. Perl has been assimilated !

Some humor is intended.

Thanks

Kode - none of none

Last edited by:

kode: Jul 24, 2002, 7:31 PM
Quote Reply
Re: [perlman] Is this possible? In reply to
when you check a checkbox.. the value of the checkbox is given to the field.. ie:

<input type="checkbox" name="DOYOUWANTTODIE" value="yes">

so... $FORM{DOYOUWANTTODIE} is equal to "yes" if that checkbox is checked..

if it's not checked.. it'll have no value..

and since checkboxes can have multiple values, i believe that in most form parsers, they concatinate the value to the scalar.. so if you want it in an array, you could just split /,/, $FORM{DOYOUWANTTODIE}

in CGI.pm, i think the parameter is an array ref (but i'm not sure). it'd be @{$in->param ('DOYOUWANTTODIE')}