登录代码Jquery移动使用PHP


Log In Code Jquery Mobile using PHP

嘿,我正在一个登录代码工作,但显然我的查询不能正确运行。我的登录页面是这样的:

<div data-role="page" id="login">

    <div data-role="main" class="ui-content">       
    <?php
 session_start();
 include_once('config.php');
 if(isset($_POST['submit']))
 {
  $email = trim($_POST['email']);
  $contraseña = trim($_POST['contraseña']);

$query = "SELECT * FROM `Usuarios` WHERE Email='$email' AND Contraseña='$contraseña' AND com_code IS NULL";
  /** $result = mysqli_query($con,$query) or die(mysqli_error()); **/
  if($connect->query($query))
{
    echo '<p>Executed Successfully</p>';
} else {
    echo '<p>Error in execution</p>';
}

  /**$num_row = mysqli_num_rows($result);
  $row=mysqli_fetch_array($result);
  if( $num_row ==1 )
         {
   $_SESSION['user_name']=$row['Nombre'];
   header("Location: pages/home.php");
   exit;
  }
  else
         {
    header("Location: services/invalid.php");
   exit;
  }**/
 }
?> 

    <div id="logo" style="text-align:center">
    <img src="img/LogoAzul.png" width="50%" height="auto">
    </div> <!------LOGO---->

        <form action="index.php" method="post">
        <label for="email">Email:</label>
        <input type="text" name="email" id="email" value="">
        <label for="contraseña">Contraseña:</label>
        <input type="text" name="contraseña" id="contraseña" value="">
        <fieldset data-role="controlgroup">
        <input type="checkbox" name="recuerdame" id="recuerdame">
        <label for="recuerdame">Recuerdame </label>
        </fieldset>

        <input type="submit" value="Entrar">
        </form>

       <p class="mc-top-margin-1-5"><a href="#recuperarcontraseña">¿Olvidaste tu contraseña?</a></p>
        <p class="mc-top-margin-1-5">¿No eres Usuario?  <a href="#nuevousuario">Registrate Aqui</a>.</p>

我的配置文件是这样的:

<?php
    $host_name  = "*******************";
    $database   = "******";
    $user_name  = "******";
    $password   = "***********";
    $connect = new MySQLi($host_name, $user_name, $password, $database);
    if ($connect->connect_errno) {
        die("Sorry, we are having some problems.");
    }

    $con = mysqli_connect($host_name, $user_name, $password, $database);
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
?>

我认为不工作的部分是执行查询,如果不是它必须在登录页面的php内。

请帮帮我!

当您尝试登录时,您正在寻找名称为submit的表单元素,但您没有一个。在提交按钮中添加submit这个名称,它应该可以正常工作。

<input type="submit" name="submit" value="Entrar">