Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Submit在jQueryPost的同一页面上返回一个空值_Php_Javascript_Jquery_Mysql_Login - Fatal编程技术网

Php Submit在jQueryPost的同一页面上返回一个空值

Php Submit在jQueryPost的同一页面上返回一个空值,php,javascript,jquery,mysql,login,Php,Javascript,Jquery,Mysql,Login,我试图用JQuery帖子创建一个帖子页面,但由于某种原因,当我按下post按钮时,它会将我重定向到同一页面,而不会执行任何操作。我不知道我在这里错过了什么 我想要的是,当它登录时,它会将我带到另一个页面logged-in.php 你能看一下吗 页 JS用户登录 PHP save_details.PHP 谢谢。当您按下提交按钮时,表单会自动提交,导致页面重新加载,因为页面需要重新加载才能发送数据-因此,javascript不会运行。要防止此行为,请执行以下操作: <form class="f

我试图用JQuery帖子创建一个帖子页面,但由于某种原因,当我按下post按钮时,它会将我重定向到同一页面,而不会执行任何操作。我不知道我在这里错过了什么

我想要的是,当它登录时,它会将我带到另一个页面logged-in.php 你能看一下吗

页 JS用户登录 PHP save_details.PHP
谢谢。

当您按下提交按钮时,表单会自动提交,导致页面重新加载,因为页面需要重新加载才能发送数据-因此,javascript不会运行。要防止此行为,请执行以下操作:

<form class="form-2" action="./" method='post' autocomplete="off" onclick="event.preventDefault();">

这应该会对您有所帮助。

当您按下提交按钮时,表单会自动提交,导致页面重新加载,因为页面需要重新加载才能发送数据-因此,javascript不会运行。要防止此行为,请执行以下操作:

<form class="form-2" action="./" method='post' autocomplete="off" onclick="event.preventDefault();">
这应该对您有所帮助。

您需要返回false;在用户登录功能结束时,可以防止表单正常提交。此外,如果你的JS中有语法错误,表单将继续提交;在用户登录功能结束时,可以防止表单正常提交。此外,如果JS中有语法错误,表单将继续并提交。
$user_email = trim(strip_tags($_POST['email']));
        $user_password = trim(strip_tags($_POST['passwd']));
        $encrypted_md5_password = md5($user_password);

        $validate_user_information = mysql_query("select * from `signup_and_login_table` where `email` = '".mysql_real_escape_string($user_email)."' and `password` = '".mysql_real_escape_string($encrypted_md5_password)."'");

        if(mysql_num_rows($validate_user_information) == 1)
        {
            $get_user_information = mysql_fetch_array($validate_user_information);
            $_SESSION["VALID_USER_ID"] = $user_email;
            $_SESSION["USER_FULLNAME"] = strip_tags($get_user_information["firstname"].'&nbsp;'.$get_user_information["lastname"]);
            echo 'index.php?uid='.$_SESSION["USER_FULLNAME"].'&';
            echo 'login_process_completed_successfully=yes';
        }
        else
        {
            echo '<br><div class="info">Sorry, you have provided incorrect information. Please enter correct user information to proceed. Thanks.</div><br>';
        }
<form class="form-2" action="./" method='post' autocomplete="off" onclick="event.preventDefault();">