Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tickbox Difficulties 1

Status
Not open for further replies.

chris921

Technical User
Mar 9, 2004
82
GB

If I have a form with three tickboxes, for example tickbox1, tickbox2, tickbox3, can someone tell me a piece of code such that if the tick box is ticked, and the submit button pressed, then it generates 10 points for each tickbox that is ticked and outputs the final score?

Thanks if you can,
Chris
 
Code:
use CGI;
my $query=new CGI;
print $query->header ;

my $score = 0 ;

if($query->param('tickbox1')){$score +=10;}
if($query->param('tickbox2')){$score +=10;}
if($query->param('tickbox3')){$score +=10;}

print "Score is $score";

Change 'tickbox1' etc to the actual names of the fields in your form. Add copies of that line for additional checkboxes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top