473,725 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form processing: change the "action=" based on pull down menu

Hi group -

I have an html form for that uses username and password to login to a
specific area of the website. The "area" the user wants to go to is
based on a pull down menu. Becasue the user/password info is in
differnet databases, how can I call different validation scripts based
on this input ?
THANK YOU!

See below please. Somethinglike this:

form.html:
<form name="loginform " method="post" action="login.p hp">
<select name="loginform ">
<option value="one">Sec tion 1</option>
<option value="two">Sec tion 2</option>
</select>

login.php:

@extract($_POST );
if($_POST[loginform] == "one") {

echo "action = /forums/scc/dispatch.cgi/_admin/AVFLogin"
NAME="LoginForm " >
echo "<input type=hidden name=\"autologi n\" value=\"1\">\n" ;
echo "<input type=hidden name=\"formstyl e\" value=\"standar d\">\n";
echo "<input type=hidden name=\"returnfo rum\" value=\"_admin\ ">\n";
echo "<input type=hidden name=\"returnms g\"
value=\"acahome page\">\n";

} else {

echo "action = /path to different cgi \n";
echo :different values for hidden fields".

}
Jul 16 '05 #1
2 11436
Sylvie Stone wrote:
Hi group -

I have an html form for that uses username and password to login to a
specific area of the website. The "area" the user wants to go to is
based on a pull down menu. Becasue the user/password info is in
differnet databases, how can I call different validation scripts based
on this input ?
THANK YOU!


Hi,

This is actually a javascript trick you need.
You can dynamically set the action of a form, just by assigning a new value
to it.

Try something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>formacti ontest</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR " content="Quanta Plus">

<script language="javas cript">

function doSubmit(){
// get the chosen option
selind = document.forms. mydynamicform.s electaction.sel ectedIndex;
// get the value
selval = document.forms. mydynamicform.s electaction[selind].value;

// now set this value as action for the form
document.forms. mydynamicform.a ction=selval;

// and submit
document.forms. mydynamicform.s ubmit();

}

</script>

</head>
<body>

<form action="unknown yet" METHOD="POST" name="mydynamic form">

Choose your action:
<select name="selectact ion">
<option value="login1.p hp">go to login 1</option>
<option value="login2.p hp">go to login 2</option>
<option value="login3.p hp">go to login 3</option>
</select>
<br>
Your name? <input type="text" name="yourname" size=10>
<br>
<input type="button" onClick="doSubm it()" value="Go!">

</form>

</body>
</html>
Regards,
Erwin
Jul 16 '05 #2
sy*********@can ada.com (Sylvie Stone) wrote in message news:<18******* *************** ****@posting.go ogle.com>...
Hi group -

I have an html form for that uses username and password to login to a
specific area of the website. The "area" the user wants to go to is
based on a pull down menu. Becasue the user/password info is in
differnet databases, how can I call different validation scripts based
on this input ?
THANK YOU!

THANKS A LOT to Erwin and NC for posting two excellent solutions.
i have taken bits from each and implemented the code and it's working very well.

Thanks again,

Syl.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3915
by: Aatu Koskensilta | last post by:
When processing HTML-files for various purposes, I run into a strange form action definition looking like "r/sx/*-http://somehow/somescript" In particular, the Yahoo search form uses a form action attribute which looks like this. What's the meaning of the "r/sx/*-"-prefix?
3
4361
by: Zhidian Du | last post by:
I am using java to write to url, http://fatigo.bioinfo.cnio.es/ , but I found the form is : <form method="post" action="/" enctype="multipart/form-data" name="fatigo"> I have no idea why the action is not a URL, can you explain it why. Thanks.
7
2774
by: M | last post by:
i have a form which i would like to input different "action" url depending on the button that was clicked. is there a way that javascript can prefill a defined action based on the button pressed? thanks!!!
1
2006
by: tnhoe | last post by:
Hi, <Form method='post' action="next.htm?btn="+"this.myform.myobj.value"> What is the correct syntax for above ? Regards Hoe
3
3062
by: asianboi | last post by:
Hi, In my application, I have a web browser control and load up a local html page. Within the html page, the following code exists. However, when I click on the button that invokes the 'form action', nothing happens. I'd like the event to spawn a new browser window. Is there an event I should be catching? <!-- search box -->
4
3256
by: Bosconian | last post by:
I have created a form tool page that consists of several dropdowns which allows a user to drill down and select a desired document for viewing in an external window. I need to post the form data to the external window so the values can be used to retrieve the appropriate document. The function below will open the window and post the form data accordingly, but when defining the action property it changes the original form action property....
6
19146
by: Arthur | last post by:
Hello. How might it be possible to change where a form action is directed based on a selected option. For example I have this: <FORM METHOD = "post" ACTION = ""> And a drop down such as
3
7020
by: phpnewbie2007 | last post by:
Hello, I have a dropdown which populates from a database. When user selects option 1 from the dropdown, he should be directed to sample.php, if he selects option 2, then to sampleb.php and so on. The code is as follows: <html> <head> <script language="JavaScript">
8
8254
by: webandwe | last post by:
Hi, I have to radio buttons and depending on the selection it must eighter insert step2.php or insert.php in the action part of the form. Now it's just going to steo2.php I also tried elseif ($rado="no") but thats giving the same problem. Thans
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.