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

  • Home
  • SEARCH
  • 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 6332973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:22:28+00:00 2026-05-24T18:22:28+00:00

Well let me explain the code first: First the user enters the id, the

  • 0

Well let me explain the code first:

First the user enters the id, the jquery checks the database for the id..if the id exists it fetches the results and displays in the remaining form boxes, if not it displays no id with some styling.

here is the code:

Javascript and html

 <script type="text/javascript" src="jquery.js"></script> 
<script type="text/javascript">
$(document).ready(function(){
$("#button1").click(function()
{
//remove all the class add the messagebox classes and start fading

$("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
    //checks if the id exists
    $.post("script_3.php",{ id:$('#id').val(),rand:Math.random() } ,function(data)
    {
        if(data=='yes')//correct id detail
        {
            $$("#msgbox").fadeTo(200,0.1,function()
            {
                $(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1,
                function()
                {
                  $.post('script_1.php', { id: $('input[name="id"]', '#myForm').val()   

 },  
                  function(json) { 
                  $("input[name='title']").val(json.title);
                  $("input[name='name']").val(json.rno);
                     }, "json"); 
                     });

        });
      } 

      else 
      {
          $("#msgbox").fadeTo(200,0.1,function()
          { 
          //add message and change the class of the box and start fading
          $(this).html('NO ID...').addClass('messageboxerror').fadeTo(900,1);
        });        
      }

    });
     return false; //not to post the  form physically
});

Html side:

<style type="text/css">
body {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}
.top {
margin-bottom: 15px;
}
.buttondiv {
margin-top: 10px;
}
.messagebox{
position:absolute;
width:100px;
margin-left:30px;
border:1px solid #c93;
background:#ffc;
padding:3px;
}
.messageboxok{
position:absolute;
width:auto;
margin-left:30px;
border:1px solid #349534;
background:#C9FFCA;
padding:3px;
font-weight:bold;
color:#008000;

}
.messageboxerror{
 position:absolute;
width:auto;
margin-left:30px;
border:1px solid #CC0000;
background:#F7CBCA;
padding:3px;
font-weight:bold;
color:#CC0000;
}

</style>

<body>

<form id="myForm" method="post">
id: <input type="text" name="id"/>
<div id="hidden" style="display: none;">
<p>Title:<input type="text" name="title"/></p>
<p>Name:<input type="text" name="rno"/>
</div>
<br/> 
<input type="button" id="button1" value ="Get Info"        
onclick="document.getElementById('hidden').style.display = '';"/> 
<span id="msgbox" style="display:none"></span>
</form>
<div id="age"></div>
</body>

script_3.php

 <?php
  //connect to DB removed
 $id= mysql_real_escape_string($_POST['id']);

$sql="SELECT id FROM parentid WHERE id='".$id."'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if(mysql_num_rows($result)>0)
{
echo "yes";
    //now set the session from here if needed
    $_SESSION['u_id']=$id; 
 }
 else
 echo "no"; //Invalid Login
 ?>

Well the problem i have is its not going to script_1.php part and it is always displaying no id error even if i enter the correct id.

I there any syntax error in the code??

plzz let me know if u have ant questions.

  • 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-24T18:22:28+00:00Added an answer on May 24, 2026 at 6:22 pm

    I think your problem may be

    $('#id').val()
    

    There is no element with the id='id'

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

Sidebar

Related Questions

First let's explain what I want to do and then ask my question! Well,
First let me explain that I am on a hosted solution, and there is
First let me explain that I am on a hosted solution, and there is
Well, this is my first post here and really enjoying the site. I have
I have a very weird problem with resx based localization. At first, let me
I know the question title isn't the best. Let me explain. I do a
Let's say I have the following code: public class Foo { private int x;
First let me appologize if my description of this is completely retarded, still learning
Alright let me explain myself here: I am making an online text based game.
I will try to explain this very simple. So, I skipped any code which

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.