Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6149469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:27:20+00:00 2026-05-23T19:27:20+00:00

hello I am new here and in programming as well. Today I have been

  • 0

hello I am new here and in programming as well. Today I have been made a login form in php / mysql and jquery form validation and was surprised that my form do not work bacause of js script? withou work well.

<div class="top_login_error" id="top_error">All fields must be field</div>
    <div id="logincontainer">
        <div id="loginbox">
            <div id="loginheader">
                <div>Control Panel Login</div>
            </div>
            <div id="innerlogin">
                <form method="POST" action="obr.php" id="login_form">
                    <p>Enter your username:</p>
                    <input type="text" class="logininput" name="login" id="login" />
                    <p>Enter your password:</p>
                    <input type="password" class="logininput" name="password" id="password" />
                    <input type="submit" class="loginbtn" value="Submit" name="enter" id="admin_login" /><br />
                    <p><a href="#" title="Forgoteen Password?">Forgotten Password?</a></p>
                </form>
            </div>
        </div>
        <img SRC="../images/administration/login_fade.png" alt="Fade" />
    </div>
</body>

jquery ccode for validating form

$('#admin_login').click(function(q){

q.preventDefault();

    var login = $('#login').val();
    var password = $('#password').val();

    if (login.length == 0){
        $('#top_error').fadeIn(500);
        $('#login').addClass("logininput_error");
        var error = true;
    } else {
        $('#top_error').fadeOut(500);
        $('#login').removeClass("logininput_error");
        }
    if (password.length == 0){
        $('#top_error').fadeIn(500);
        $('#password').addClass("logininput_error");
        var error = true;
    } else {
        $('#top_error').fadeOut(500);
        $('#password').removeClass("logininput_error");
        }

});

and php

<?php 
session_start(); 



    if (isset($_POST['login'])){$login = $_POST['login'];} if ($login == ''){unset($login); exit('please enter name');}
    if (isset($_POST['password'])){$password = $_POST['password'];} if ($password == ''){unset($password); exit('please enter password');}

    $login = mysql_escape_string($_POST['login']);
    $password = mysql_escape_string($_POST['password']);

    //$password = md5($password); I have been disabled while testing in simle way, login : aaa , password : aaa;

    include("../db.php");

    $result = mysql_query("SELECT * FROM users WHERE login='".$login."' and password='".$password."'") or die(mysql_error());

    $line = mysql_fetch_array($result);

    if (empty($line['id'])){
        exit("Your name or login is incorect <a href='login.php'>back</a>");
    } else {

    $_SESSION['autorized'] = true;
    $_SESSION['login'] = $login;
    $_SESSION['password'] = $password;
    }
    echo "<html><head><meta http-equiv='Refresh' content='0; URL=index.php'></head></html>";

?>

Can someone help me with code, tell what to change that everything work fine. Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:27:21+00:00Added an answer on May 23, 2026 at 7:27 pm

    The culprit is q.preventDefault();, only do that when the form shouldn’t be submitted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i have new Problem with Add Form my problem here WARNING: /test.xhtml @24,173
hello I'm new to PHP programming and I migrated from ASP .net to PHP..
Very new to JS here. When I write PHP I have no problem assigning
hello friends i m new to jQuery and nyro modal. right now i m
Hello I have a user model and a ratings model. Whenever a new user
Let's say I have these two arrays: string[] arr1 = new string[2]{Hello, Stack} string[]
Introduction : Hello Everyone, I have been looking for days for a way to
Hello everyone I am just learning my first programming language and have just corrected
Hello developers, again here with new problem !! In my thread program I was
I've been looking into how programming languages work, and some of them have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.