0
我做一个简单的登录检查和不知道如何将数据发送到比在动作标签中指定其他的PHP文件。如何发送数据到php文件其他的动作=“”?
如在此代码,我想$ cuslog = $ _ POST [ 'cuslog'];去其他PHP文件,但页面去的动作标签(e.action ='网站/ gallery.html)指定的HTML文件?
的想法是一旦客户名称数据被选中(如果存在的话),那么页转到图库HTML和客户ID输入发送到另一个PHP文件知道谁正在使用的页面。
我的知识仅限于PHP,JavaScript中,CSS和HTML的时刻。
HTML的login.html
<html>
<head>
<title>about</title>
<link rel="stylesheet" type="text/css" href="navbar.css">
<body>
<form method="post" action="../login.php" class="form" >
<div class="login">Custormer ID<br><input type="text" name="cuslog">
<input type="submit" value="Login"></div>
</form>
</body>
</html>
PHP命名的login.php
<?php
$cuslog=$_POST['cuslog'];
?>
<html>
<head><title>Login</title>
<body>
<form id="to-login" method="POST">
<input type="hidden" name="hidden_username" value="<?php echo $cuslog; ?>" />
</form>
</body>
</html>
<?php
if (!empty($_POST["cuslog"])){
$cuslog=$_POST['cuslog'];
$search=mysql_query("select CustomerID from orders where
CustomerID=$cuslog");
$rows=mysql_num_rows($search);
//$data=mysql_fetch_row($search);
if($rows !== 0){
echo" <script type=\"text/javascript\">
var e = document.getElementById('to-login');
e.action='WEBSITE/gallery.html';
e.submit();
</script>";
}
else {
echo "[Login]Account Doesn't Exist<br>";
}
}
?>
你为什么不使用Cookie来的工作吗? –
您可能需要使用Ajax将用户名发送到php文件 –
您应该通过会话管理用户并将用户重定向到相册中 –