Solved

buttons for multiple scripts

Posted on 1997-02-10
1
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

705 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