PHP Form not directing to correct pages

后端 未结 4 1181
挽巷
挽巷 2021-01-26 18:11

I\'m making a login page for the admins to make some changes to a website easily. However, the login page isn\'t working correctly. It won\'t go to the error page Invali

4条回答
  •  我在风中等你
    2021-01-26 18:42

    Two problems are joining forces to cause this error. First, your PrepSQL function does not echo the response, and neither does the code that calls it. You need to echo or print the response so that it appears in your generated HTML.

    
    

    Second, you need to encapsulate that value of the action attribute in double-quotes, like this:

    Also note that your code assumes that your mysql_query() statements were successful. For troubleshooting purposes, you should at least add an or die(mysql_error()) statement to the end of the mysql_query() lines. This will allow your code to provide some feedback when the query fails.

    Additionally, please note that your query-handling method will never result in a valid login response.

    $checkUserName = mysql_query($checkUserNameQuery);
    $checkPassWord = mysql_query($checkPassWordQuery);
    if (($userName == $checkUserName) && ($passWord == $checkPassWord))
    

    mysql_query() returns a MySQL resource, not a single field from the database. Your code attempts to compare that resource to the supplied username and password, and the comparison will always fail. For details about handling the results of mysql_query() see the documentation.

提交回复
热议问题