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 654409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:29:28+00:00 2026-05-13T22:29:28+00:00

when i click post the post response that i am getting from firefox is:

  • 0

when i click post the post response that i am getting from firefox is: (when i enter k for username)

password
username k

Source: username=k&password=

the print received from the php wont display in the #errorshow div

here is my code
(html)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">


$(function() {

 $("#login_form").submit(function() {


 var uname = $("#username").val();
 var upass = $("#password").val();
 $.post("auth.php", { username: uname, password: upass}, function(data) {
 $("#errorshow").html(data);

 });

 return false;


 });

 });



</script>
</head>
<body>
<form id="login_form" method="post">
<p>Username: <input type="text" id="username" /></p>
<p>Password: <input type="password" id="password" /></p>
<p><input type="submit" value="Login" /></p>
</form>
<div id="errorshow"></div>
</body>
</html>

here is the php (auth.php)

<?php
mysql_connect("","","") or die(mysql_error());
mysql_select_db("") or die(mysql_error());

$username = $_POST['username'];
$password = $_POST['password'];



$query = mysql_query("select username,password,active,role from tbl_logins where username = '$username'") or die(mysql_error());
 while($row = mysql_fetch_assoc($query)) {

 // CHECK FOR EMPTY FIELDS
    if(empty($username) || empty($password)) {
    print "the username or password is empty";
    }




    //CHECK FOR USERNAME EXISTANCE
    elseif($db->num_rows($query) == 0) {
 print "the username you entered doesnt exist";
 }


    //CHECK FOR PASSWORD IS CORRECT
    elseif(sha1($password) != $row['password']) {
 print "the password you entered is incorrect";
 }


     //CHECK IF ACCOUNT IS ACTIVE
     elseif($row['active'] == 'no') {
     print "your account is not active. please verify your email";
  }


 else {

 //create cookie and login user.

 $_SESSION['AUTHID'] = sha1($row['hash']);

 //routh to appropriate role section
 if($row['role'] == "0") {
 $_SESSION['error'] = "";
 header("Location: /_admin/dashboard.php");
 } else {
 $_SESSION['error'] = "";
 header("Location: /worldex/_members/index.php");
 }

 }//end else


 } //end while


?>
  • 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-13T22:29:29+00:00Added an answer on May 13, 2026 at 10:29 pm

    Try changing the line:

    $(function() {
    

    to

    $(document).ready(function() {
    

    As your script is trying to bind the ‘submit’ method to a form that doesn’t exist (until the page has loaded)

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

Sidebar

Ask A Question

Stats

  • Questions 482k
  • Answers 482k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Duplicate the position data, as in have 12 vertex positions… May 16, 2026 at 6:43 am
  • Editorial Team
    Editorial Team added an answer A one-to-one in NHibernate is, by design, a relationship that… May 16, 2026 at 6:43 am
  • Editorial Team
    Editorial Team added an answer Use the php form array syntax name="item-desc[<?php echo $id?>]" You… May 16, 2026 at 6:43 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.