Make Login Form With JQuery v2 PHP Script


Make Login Form With JQuery v2 PHP Script

In this tutorial, we are going to learn How To Make Login Form With JQuery In PHP. This is simple project and it consists username and password.

Username: tutorial
Password: admin
Database Name: login_jquery

You can use it to your Website or System. Download the source code and try it. Enjoy Coding…
Directions:
For JQuery Code

 

 

    <script type="text/javascript">
    $(document).ready(function() {
    $("#submit").click(function() {
        var username = $("#username").val();      
          var password = $("#password").val();
          if(username=='' || password=='' ){ 
          alert("Please enter the username and password");
          }
          else {            
        $.ajax({
        type: "POST",
        url: "login_function.php",
        data:  "username="+ username + "&password=" + password ,
     
          beforeSend: function() 
                {
                      $('#display_query').html('Loading....');
                },  
                success: function(response)
                {
                      $("#display_query").fadeIn(2000).html(response);
     
                      document.getElementById('username').value='';
                  document.getElementById('password').value='';
     
                } 
    });
    }            
        return false;
          });
     
    });
    </script>

 

For PHP Code

 

    <!---
    Welcome to the Sourcecodester.com
    For more tutorials, kindly visit our website:
     
    https://www.sourcecodester.com/
    -->
    <?php
    $db = mysql_connect('localhost','root','') or die ("Unable to connect to Database Server.");
    mysql_select_db ('login_jquery', $db) or die ("Could not select database.");
     
    if(isset($_POST['username']))
    {
     $username=$_POST['username'];
     $password=$_POST['password'];
     $query = mysql_query("select * from user  where username='$username' and password='$password' ")or die(mysql_error());                  
                $data = mysql_fetch_row($query);
                if($data){      
                echo '<div id="sucess"><img src="image/success.png"></div>';}
                else {
                echo '<div id="error"><img src="image/invalid.png"></div>';}
     
    }?>

 

For CSS Code

 

    <style type="text/css">
    #display_query {
          display:none;
          border-radius:3px;
          margin-bottom:4px;
    }
     
    table {
          width:300px;
          float:left;
    }
     
    label {
          color:blue;
          font-size:20px;
          font-weight:bold;
    }
     
    .text_style {
          font-size:18px;
          text-indent:5px;
    }
     
    .btn_style {
          font-size:18px;
          border:3px groove #CCC;
          border-radius:7px;
          width:100px;
          font-weight:bold;
    }
    </style>

 

For HTML Code

 

    <form method="post" name="form" action="">
    <table cellspacing="4" cellpadding="4">
          <tr style="background-color:#000000;">
                <td colspan="2" align="center">
                      <h2 style="color:#FFFFFF;">Enter the details below...</h2>
                </td>
          </tr>
          <tr>
                <td>
                      <label>Username</label>
                </td>
                <td>
                      <input name="username" class="text_style" placeholder="Username..." type="text" id="username" />
                </td>
          </tr>
          <tr>
                <td>
                      <label>Password</label>
                </td>
                <td>
                      <input name="password" class="text_style" placeholder="Password..." type="password" id="password" />
                </td>
          </tr>
          <tr>
                <td colspan="2" align="center">
                      <input type="submit" class="btn_style" name="submit" value="Submit" id="submit" />
                </td>
          </tr>
          <tr>
                <td colspan="2">
                      <div align="center" id="display_query"></div>
                </td>
          </tr>
    </table>
    </form>
     
    <table style="margin-left:100px;">
          <tr>
                <td>
                      <label>Database Name</label>
                </td>
                <td>
                      <span style="color:red;">login_jquery</span>
                </td>
          </tr>
          <tr>
                <td>
                      <label>Username</label>
                </td>
                <td>
                      <span style="color:red;">tutorial</span>
                </td>
          </tr>
          <tr>
                <td>
                      <label>Password</label>
                </td>
                <td>
                      <span style="color:red;">admin</span>
                </td>
          </tr>
    </table>
     
    <a href="https://www.sourcecodester.com" style="float:right;">
          <h3>
                Sourcecodester
          </h3>
    </a>

 

 

 

Learn How to install Make Login Form With JQuery v2 PHP Script?



Find More related Make Login Form With JQuery v2 PHP Script



Make PHP Script | Login PHP Script | M PHP Script | Wh PHP Script | Jquery PHP Script | V2 PHP Script | Php PHP Script | Script PHP Script | Th PHP Script | Tutorial PHP Script | We PHP Script | going PHP Script | To PHP Script | Learn PHP Script | How PHP Script | To PHP Script | Make PHP Script | Login PHP Script | M PHP Script | Wh PHP Script | Jquery PHP Script | Php PHP Script | Th PHP Script | Simple PHP Script | Project PHP Script | Consts PHP Script | Username PHP Script | 2021 Top 100 Make PHP Script | Top 10 Login PHP Script | Top 50 M PHP Script | 2021 Top 40 Wh PHP Script | Top 100 Jquery PHP Script | Top 50 V2 PHP Script | 2021 Top 100 Php PHP Script | Top 20 Script PHP Script | Top 100 Th PHP Script | Top 10 Tutorial PHP Script | Top 100 We PHP Script | Top 500 going PHP Script | Top 1000 To PHP Script | Top 5000 Learn PHP Script | Top 50 How PHP Script | Top 50 To PHP Script | Top 50 Make PHP Script | Top 50 Login PHP Script | Top 50 M PHP Script | 2021 Top 50 Wh PHP Script | Top 50 Jquery PHP Script | Top 50 Php PHP Script | Top 50 Th PHP Script | Top 50 Simple PHP Script | Top 20 Project PHP Script | Top 20 Consts PHP Script | Top 10 Username PHP Script | Popular 100 Make PHP Script | Popular 10 Login PHP Script | Popular 50 M PHP Script | Popular 40 Wh PHP Script | Popular 100 Jquery PHP Script | Popular 50 V2 PHP Script | Popular 100 Php PHP Script | Popular 20 Script PHP Script | Best 100 Th PHP Script | Best 10 Tutorial PHP Script | Best 100 We PHP Script | Best 500 going PHP Script | Best 1000 To PHP Script | Best 5000 Learn PHP Script | Popular 50 How PHP Script | 2021 New 50 To PHP Script | 2021 New 500 Make PHP Script | 2021 New 1000 Login PHP Script | 2021 Top 500 M PHP Script | 2021 Best 500 Wh PHP Script | 2021 New 10 Jquery PHP Script | 2021 Popular 500 Php PHP Script | 2021 Popular 20 Th PHP Script | 2021 New 1050 Simple PHP Script | 2021 Top 200 Project PHP Script | 2021 New 20 Consts PHP Script | 2021 Best 100 Username PHP Script |

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Horje

Horje