Click here to Skip to main content
11,710,943 members (82,225 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: HTML PHP jQuery
I am new to php and jquery and I am stuck at one point in displaying result to textbox.

I have created 1 client.php file where i have 1 employee id textbox,submit button, employee name textbox.
Now i am using jquery to get employee id from textbox and clicks on submit button then it showed display the name of the employee whose that particular employee id is,
example:employee id: 100
here is my submit button
below that i have employee name textbox and the result should be displayed as,
Employee Name: ABC (in textbox).

I have created 1 server.php file where i am selecting the data from mysql database.

In server.php file i am getting data from mysql database and want to pass it to client.php file.

Data is comming from database correctly but the only problem is showing it on the textbox.
I have used google chrome debuuger to check if data is comming or not and it is coming neatly.

Please suggest any solution for these if any...
Posted 27-Feb-13 3:05am
Edited 27-Feb-13 3:06am
loctrice at 27-Feb-13 10:57am
you should post your client side html and jquery code. If you know the data is coming from the server correctly, then that will help us trouble shoot it.
amolpatil011 at 28-Feb-13 7:09am
My "client.php" code is as show below,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Get Details of Specified Employee</title>

<script src=""></script>

<script type="text/javascript">
function getdetails()
var empid=$('#txtid').val();

$.ajax( {
type: "POST",
url: "server.php",
data: { empid:empid}

} ).done(function( result ) {
//document.getElementById('txtname').innerHTML = result['empname'];
//.done(function( result ) {
$("#lblid").html( result['empname'] );
//$('<%=txtname.ClientID %>').val(result["empname"]);
//$("#txtsal").val( result['empname']);
/*var gg=result['empname'];
$('#lblid').html( " Address of Roll no is "+result );

} );



<table width="577" border="1">
<td width="142">Employee ID</td>
<td width="229"><label for="txtid"></label>
<input type="text" name="txtid" id="txtid" /></td>
<td width="184"> </td>
<td> </td>
<td><input type="submit" name="btnsubmit" id="btnsubmit" value="Submit" önclick="getdetails()" /></td>
<td> </td>
<td>Employee Name</td>
<td><label for="txtname"></label>
<input type="text" name="txtname" id="txtname" /></td>
<td> </td>
<td>Employee Salary</td>
<td><label for="txtsal"></label>
<input type="text" name="txtsal" id="txtsal" /></td>
<td> </td>
<td><label id="lblid">

<td><label id="lblid">


And "server.php" code is ,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


$query="SELECT empname from emp where empid=".$empid;

$result= mysql_query($query,$con);

echo $row['empname'];


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 549
1 OriginalGriff 255
2 Peter Leow 154
3 Maciej Los 120
4 Abhinav S 120
0 Maciej Los 95
1 Richard MacCutchan 90
2 Abhinav S 90
3 OriginalGriff 80
4 Member 4653839 50

Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 19 Feb 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100