与我的PHP表单和jquery移动js冲突

时间:2015-03-14 18:55:28

标签: php jquery html

我目前正在为我的项目使用jQuery Mobile。在我的登录页面中,我需要获取用户输入的用户名和密码,但每次我要点击登录按钮时,它都不显示任何内容。但是当我试图从jQuery移动中删除cdn时它运行良好,但设计不同。 这是我的登录页面的代码:

    <!DOCTYPE html>
    <?php
    session_start();
    ?>
    <html>
    <head>
<!--CDN FROM JQUERY MOBILE-->
    <meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
    <link rel="stylesheet" href="jquery.mobile-1.4.5.css">
    <script src="jquery-1.11.2.js"></script>
    <script src="jquery.mobile-1.4.5.js"></script>
<!--END-->
    <title>Inhand Pinagkaisahan</title>
    </head>
    <body>
    <div data-role="page">
      <div data-role="header">
        <h1>Inhand Pinagkaisahan</h1>
      </div>
    <div data-role="main" class="ui-content">
       <form method="post" action="get.php">
        <input type="text" name="uname" placeholder="Username" />
        <input type="password" name="pword" placeholder="Password" />
        <center><input type="submit">Login</center>
        <center><a href="forgotpassword.html" style="text-decoration: none">Forgot Password</a></center>
        <center><p>No account?<a href="signup.html" style="text-decoration: none"> Sign up</a> or <a href="learnmore.html" style="text-decoration: none">Learn more.</a></p></center>
    </form>
        </div>
    <div data-role="footer">
        <h1></h1>
      </div>
    </div> 
    </div> 

    </body>
    </html>

我收到此错误: 注意:未定义的索引:在第6行的C:\ xampp \ htdocs \ InhandPinagkaisahan \ get.php中取消命名 注意:未定义的索引:第7行的C:\ xampp \ htdocs \ InhandPinagkaisahan \ get.php中的pword 这是我的PHP:

<?php

    $con=mysql_connect('localhost','root','ADMIN') or die(mysql_error());
    mysql_select_db('inhand') or die("cannot select DB");
    <!--This is the part not is not working when ever i'm going to use the cdn, but when i comment out the cdn, it works properly.-->
    $uname=$_POST['uname']; 
    $pword=$_POST['pword']; 
<!--END-->

    $query=mysql_query("SELECT * FROM user WHERE uname='$uname' AND pword='$pword'");
    $numrows=mysql_num_rows($query);
    if($numrows!=0)
    {
    while($row=mysql_fetch_assoc($query))
    {
    $dbusername=$row['uname'];
    $dbpassword=$row['pword'];
    }

    if($uname == $dbusername && $pword == $dbpassword)
    {
    session_start();
    $_SESSION['sess_user']=$uname;

    /* Redirect browser */
    header("Location: newsfeed.php");
    } else {
    echo "Invalid username or password!";
    } 
}
?>

0 个答案:

没有答案