It worked on normal submit buttons but problem on image submit button.
I couldn't manage to work it with image submit buttons. Fot example if their 2 image submit buttons as : <input type="image" border="0" name="button3" value="This is button 3" src="c:\windows\desktop\house.gif" width="100" height="50"><br><br><br> <input type="image" border="0" name="button4" value="This is button 4" src="c:\windows\desktop\debugreport.jpg" width="100" height="50"> cgi cannot get the names of these? Must i use other module? thanxs bye ----- Original Message ----- From: "Brett W. McCoy" <[EMAIL PROTECTED]> To: "GsuLinuX" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, February 14, 2002 6:26 AM Subject: Re: buton names > On Wed, 13 Feb 2002, GsuLinuX wrote: > > > There are 2 submit butons under my form and the information entered to the form will be send to different cgi's. How can i do this? > > > > One idea i thougt is to give names to the buttons and in the cgi : > > if buton name is "buton1" > > { code1 } > > if buton name is "buton2" > > {code2 } > > You have two submit buttons, each with the same name but a different > value. > > print submit(-name=>'action', > -value=>'Add' > ); > > print submit(-name=>'action', > -value=>'Delete' > ); > > They won't go to different CGI scripts, but a single CGI script > will have those button names (you should give them values also) as > parameters, so you can take different action based on the button names. > I would use a hash of coderefs to handle this: > > my $action_button = param('action'); > > my %actions = ( 'Add' => \add > 'Delete' => \delete > ); > > $action($action_button)->(); > > .... > > sub add { > .. > } > > sub delete { > .... > }; > > Or, alternatively, you could use CGI::Application to accomplish this > (which also uses a hash of coderefs to handle multiple actions). > > -- Brett > http://www.chapelperilous.net/ > ------------------------------------------------------------------------ > Air is water with holes in it. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]