Solved

buttons for multiple scripts

Posted on 1997-02-10
1
148 Views
Last Modified: 2013-12-25
i have a bunch of buttons that i want to put on a page and i want each button to call a different script.  i also want the buttons displayed next to each other.  how can i do this?

<form ....action="/cgi-bin/foo.pl">
<input type=submit name="foo button">
</form>
<form ....action="/cgi-bin/bar.pl">
<input type=submit name="bar button">
</form>

is not an option as far as i can tell because i can't have the buttons next to each other.  

possibly javascript?  thanks.

Dan.
0
Comment
Question by:dpaik
1 Comment
 
LVL 1

Accepted Solution

by:
evilgreg earned 50 total points
ID: 1827624
Nah, don't use Javascript, you'll miss some of your audience. Since you are calling a script, use the power you already have. Make one script, and then have each button have a name. The "Name" attribute in a TYPE="Submit" tag is not used often, but it can be useful in cases like this. So:
<FORM ...action="foo.pl">
<INPUT TYPE="Submit" Name="Ice" Value="Cold!">
<INPUT TYPE="Submit" Name="Ice" Value="Hot!">
</FORM>

Then, in foo.pl:

#!perl etc...split stdin into variables with cgi.pl or the equivalent...stored in %in for this example:

$in{'Ice'} =~ /^Cold/ && &Bar;
$in{'Ice'} =~ /^Hot/ && &Zoo;
## else...
&Zap;

Each sub can call another program if you wish, or even have them open a new page with "Location...". I would keep them all as subroutines within one script myself, branching out to other scripts where necessary. HTH :)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question