普通网友 2016-09-17 17:53
浏览 7
已采纳

Isset仍未完成其工作[关闭]

I've seen this issue all over stack overflow but none of the methods helped.

Form:

<form action="login.php" method="POST">
      <input name="username" type="text" placeholder="User Name">
      <input name="rawpassword" type="password" placeholder="Password">
      <input value="Login" type="submit">
</form>

Login.php:

// Gets user entered details from form.
if (isset($_POST['username'])) {
  $username=$_POST['username'];
} else {
  $username=null;
}
if (isset($_POST['rawpassword'])) {
  $rawpassword=$_POST['rawpassword'];
} else {
  $rawpassword=null;
}

// Hashes password through SHA-1.
$password = sha1($rawpassword);

echo "$username";
echo "$rawpassword";
echo "$password";

My problem is that the

if (isset($_POST['']))

is coming back as false and will make both variables null and echos null (nothing). But if I was to do this:

if (!isset($_POST['']))

It returns the undefined index error that everyone gets.

Help will be much appricated.

  • 写回答

4条回答 默认 最新

  • dongyan0629 2016-09-21 16:53
    关注

    I have fixed the issue that I was having, obviously I didn't do enough research to find out that the problem was that JQuerymobile (should have mentioned that I was using JQuerymobile) has it's own special ways of requesting pages.

    All I needed to do was add data-ajax="false" into the <form> tag, now everything works how I wanted it to work.

    Thank you everyone for your suggestions and help.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集