Log in

View Full Version : conditional login redirect



oldtimer
10-09-2009, 11:45 PM
I have code for a popup login

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>DHTML Popup Window</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />

<link rel="stylesheet" type="text/css" href="sample.css" />

<script type="text/javascript" src="popup-window.js"></script>

</head>
<body>


<!-- ***** Form ************************************************************ -->

<form action="" onsubmit="return false;">
<div>
<input type="button" value="Standard"
onclick="popup_show('popup', 'popup_drag', 'popup_exit', 'screen-top-left', 3, 3);" />
<input type="button" value="Platinum"
onclick="popup_show('popup', 'popup_drag', 'popup_exit', 'screen-center', 0, 0);" />
</div>
</form>

<!-- ***** Popup Window **************************************************** -->

<div class="sample_popup" id="popup" style="display: none;">

<div class="menu_form_header" id="popup_drag">
<img class="menu_form_exit" id="popup_exit" src="form_exit.png" alt="" />
&nbsp;&nbsp;&nbsp;Login
</div>

<div class="menu_form_body">
<form action="login.php">
<table>
<tr><th>Username:</th><td><input class="field" type="text" onfocus="select();" name="username" /></td></tr>
<tr><th>Password:</th><td><input class="field" type="password" onfocus="select();" name="password" /></td></tr>
<tr><th> </th><td><input class="btn" type="submit" value="Submit" /></td></tr>
</table>
</form>
</div>

</div>

</body>
</html>

The only problem with it is that I can't figure out how to get the popup login to direct to two different login scripts based on the button pressed. You can see the code's directing script in red above; how would I go about making this dependent on button the button pressed?

I'm a bit new to all this so any help would be greatly appreciated! Thanks in advance!

oldtimer
10-12-2009, 08:06 PM
Seriously, any help at all would be great.

djr33
10-13-2009, 12:55 AM
Here's a similar discussion. Read my reply (third in the thread):
http://dynamicdrive.com/forums/showthread.php?t=49082

Basically, you can't actually submit a form to two different places. There can only be one action.

If you cannot do something serverside to fix this (receiving the form), then you must either go with javascript (somewhat unreliable), or find another solution entirely.