[Previous] [Contents] [Next]


Image Buttons

Image buttons are the same as Submit buttons, except that an image is displayed instead of text. For example, you can place an image of a mailbox that could cause the action of mailing the form contents to a certain user. Using raw HTML, image buttons are created with the INPUT tag with TYPE image, as seen here:

<INPUT TYPE=image SRC="images/doit.gif" NAME='action'

        VALUE='Doit' ALIGN=middle>


Using CGI::Form, this is a call to the method image_button, as shown in the following example:

$q->image_button( -src=>"images/doit.gif", -name=>'action', -value=>'Doit',

                   -align=>'middle' );


-src is used to specify the URL to the image which is to be displayed; -name specifies an arbitrary name associated with the image button; -value specifies an arbitrary value. The -name and -value parameters are important to distinguish the action between multiple image buttons on a form. -align is used to line up the image with the text that follows it. The possible values for -align are top, middle, and bottom.

[Previous] [Contents] [Next]