Login script not working as required

后端 未结 2 1147
甜味超标
甜味超标 2021-01-22 09:15

I am new to php and tried to develop a login script but when i enter values it is not working. I cant even find the errors because when i click on submit it just refreshes the p

相关标签:
2条回答
  • 2021-01-22 09:33

    ok, you have an echo statement with a file name:

       echo "myaccount.php";
    

    First of all, are you sure that is what you want to do? I believe that will echo the string "myaccount.php". I believe you would want to include "myaccount.php"

    secondly, you have referenced the form field "user_name" in your javascript, but the field name you are trying to access is named "email". That might be part of the issue as well.

    0 讨论(0)
  • 2021-01-22 09:37

    You are using form method="post", yet looking for $_GET.

    Either use method="get" or $_POST!

    As you have gathered from the comments there are several other issues with your code with regards to security. Don't be disheartened - everyone was a beginner once. However, you really should read up on SQL Injection and stop assigning all the $_GET values to strings - name each of them in full, ie:

    $user_name = trim($_GET['user_name']);
    

    Good luck, and stick with it!

    [edit]Ah, as Stephen rightly points out in the comments, the JS uses get to submit the post, so it's actually the field name of 'email' that's the problem.

    0 讨论(0)
提交回复
热议问题