【问题标题】:Go to another page the password is correct in php转到另一个页面 php 中的密码是正确的
【发布时间】:2015-04-16 04:42:35
【问题描述】:

我正在用 php 和 html 开发一个应用程序,用户必须在其中输入一个数字。但是,如果数字是 1 按下按钮会打开另一个页面,但如果数字不同则不会打开任何内容。我使用的代码如下:

<html>
  <head>
    <title>RHM</title> 
      <style type="text/css">
    h1 { color: red; font-family: arial; font-size: 3em; font-weight:   bolder; }
    p { color: navy; font-family: Verdana; }
   </style>
  </head>
 <body>
   <h1 align="center">INGRESE CONTRASE&Ntilde;A</h1>
     <form  action="#" method="post" >
   <p align="center"> <input type="password" name="contras" style="width:200px;height:50px;background-color:yellow;color:blue;font-size:14pt;font-family: Comic Sans MS;text-align:center;padding-right:10px;"/></p>
   <p align="center"  ><input type="submit" value="Entrar" /></p>
<?
  $Contraseña=$_POST['contras'];
   if ($Contraseña==1) {
     action=="Decidir.php";
  }
?>
  </form>
 </body>
</html>

到目前为止,这没有任何作用。请帮忙谢谢大家。

【问题讨论】:

  • header('Location: '/decidir.php')替换action=="Decidir.php";
  • 更换了。什么都不做。
  • 哦,我忘记了,你需要把你的PHP代码移到页面顶部,否则就不行了。
  • 另外,到目前为止,您已经提出了 21 个问题,但没有给出任何答案。这就是最后使用删除他/她的答案的原因。归功于其他人的帮助。
  • 具体到哪里去 php 代码?

标签: php html passwords


【解决方案1】:

我是这样解决的:

....
<?
 $Contraseña=$_POST['contras'];
   if ($Contraseña==10836053) {
     header("Location: Decidir.php");
  }
?>
</form>

感谢 sam_io。

【讨论】:

    猜你喜欢
    • 2021-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-27
    • 1970-01-01
    • 1970-01-01
    • 2018-10-29
    • 1970-01-01
    相关资源
    最近更新 更多