Solved

buttons for multiple scripts

Posted on 1997-02-10
1
144 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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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 …

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now