dousong3760 2014-02-18 15:02
浏览 21


So I've searched this site about this issue and tried what has been suggested and still no luck. I thought maybe it was my 'server' (On my tablet using KSWEB, no computer right now) so I created 2 simple files to share a session variable between the two and it worked fine. I have no idea why this isn't working for these two. I'm trying to create a login page (an insecure one, I know). The error function USED to work (this is what gets me), and now it doesn't. The files are below. I only included the top portion of admin.php because I've commented out the rest. It really shouldn't matter. Right now, if you submit the form without entering anything into the admin prompt, an error should display next to the asterisk saying "Admin needs to be filled out". Despite my best efforts, this doesn't work anymore and I'm completely stumped as to why.



  .error {color: #FF0000;}

  function submitForm()

<?php echo $_SESSION["adminErr"];?>

<h2>Administrator login page</h2>
<form method="post" action="admin.php" name="adminform">
  Admin: <input type="text" name="admin" style="position:absolute; left:100px">
  <span class="error" style="position:absolute; left:285px">*<?php echo $_SESSION["adminErr"];?></span>
  Password: <input type="password" name="password" style="position:absolute; left:100px">
  <span class="error" style="position:absolute; left:285px">*<?php echo $_SESSION["passwordErr"];?></span>
  <button onclick="submitForm()">Submit</button>

<p><?php echo $_SESSION["flogin"];?></p>






  if (empty($_POST["admin"])) // Check to make sure Admin field is filled out
    $_SESSION["adminErr"] = "Admin field must filled"; // Set error if not filled
    header("location:login.php"); // Return to login page
  • 写回答

2条回答 默认 最新


      相关推荐 更多相似问题


      • ¥15 关于用matlab进行光束整形的问题
      • ¥15 vs code编译器 C语言刚学,想的有点复杂
      • ¥15 航班订票系统函数无法运行
      • ¥20 VS2022无法启动程序,如何解决?(语言-c++|开发工具-visual studio)
      • ¥15 c语言可以做出完整的吗有人看看吗
      • ¥15 电脑流氓插件处理方法
      • ¥15 问一下这个可调恒流源电路用哪个电源接口比较好,想用tapec接口仅作为电源接口这个引脚怎么连啊
      • ¥30 Abaqus做建模的时候网格没办法收敛是为什么?
      • ¥15 车牌识别摄像镜头,httppost,nodejs
      • ¥20 腾讯云托管与本地测试 GET请求获取返回值 完全不同