1. Computing

Working with CGI.pm In-Depth

Creating Submit and Reset Buttons

From , former About.com Guide

Every web form needs a way to submit it, and the standard simple method is to drop in a submit button. There are other ways, like using ajax or using an image instead of a button, but the submit button is a standard interface element that people have come to expect. Creating a submit button is as simple as calling CGI.pm's submit function:
 print $cgi->submit(); 
Which will output:
 <input type="submit" name=".submit" /> 
There are some optional attributes you can pass in, all of which are detailed in the general form attributes section. Let's look at the most common one - what's printed on the button itself. This is handled through the -value attribute. So say, for example, you want your button to say 'Save Changes':
 print $cgi->submit(
 -value => 'Save Changes'
 ); 
That will print:
 <input type="submit" name=".submit" value="Save Changes" /> 
You can also pass in the optional -name attribute if you want to give it something other than the default name value of .submit:
 print $cgi->submit(
 -value => 'Save Changes',
 -name => 'submit_button'
 ); 
Which will output:
 <input type="submit" name="submit_button" value="Save Changes" /> 
Finally, the less used, but still fun reset button works in the same manner. Just call it with the reset function like so:
 print $cgi->reset(); 
And you end up with:
 <input type="reset" name=".reset" /> 

©2013 About.com. All rights reserved.