Solved

buttons for multiple scripts

Posted on 1997-02-10
1
149 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

696 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