我的 php 代码有两个问题。
第一个是多变
$linkorig
之后可以看到
$_POST['formsubmitted']
,当我从重定向页面得到它时?
第二个问题是如何用不同的动作提交表单,毕竟错误检查?
也许可以使用一些 javascript 或 php 代码。
<?php
$linkorig=$_POST['link-orig']; // get destination link from redirected page , for excample http://mikrotik.lv -- works fine
if (isset($_POST['formsubmitted']))
{
// script try login with credentials with <form action="login.php" --- works fine
//Error checking !
if (empty($error)) //if not found any errors {
// login with credentials and same form but with <form action="other_login.php" --- i dont know how to do :(
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login Form</title>
</head>
<body>
<form name="login" action="login.php" method="post" class="registration_form" onSubmit="return doLogin()" >
<input type="hidden" name="dst" value="<?php echo $linkorig; ?>" />
<input type="hidden" name="popup" value="true" />
<fieldset>
<legend>Login Form </legend>
<p>Enter Your username and Password Below </p>
<div class="elements">
<label for="name">Email :</label>
<input type="text" id="e-mail" name="username" size="25" value="" />
</div>
<div class="elements">
<label for="Password">Password:</label>
<input type="password" id="Password" name="password" size="25" />
</div>
<div class="submit">
<input type="hidden" name="formsubmitted" value="TRUE" value="OK" />
<input type="submit" value="Login" />
</div>
</fieldset>
</form>
<!-- $(if error) -->
<br /><div style="color: #FF8080; font-size: 9px"> </div>
<!-- $(endif) -->
<script type="text/javascript">
<!--
document.login.username.focus();
//-->
</script>
</body>
</html>