开发者

show result into html table from database

i have textfield inside html table..i want after i type something like "name" in another cell can show all information or description about people who have that name...that information are take from "member_table"...

<tr>
  <td>
      <td>
         <td><input type="text"........></td>
      </td>
  &开发者_Go百科lt;/td>
</tr>

<tr>
   <td> //i want information show here
   </td>
<tr>

what's code for it?


Well the answer would be in 3 part.

<tr>
   <td> //i want information show here
   </td>
<tr>

modify this to

<tr>
   <td> <div id="divResult"></div></td>
<tr>

Now you need to write javascript

<script>
 // Get the data from the text field
var txtName = document.getElementById("txtName").value;

// Assuming there is a Ajax Function
ajax(txtName);
//Call back function for ajax
function callBack()
{
  if(ajaxObj.... )
  {
    document.getElementById("divResult").innerHTML = ajaxObj.responseText;
  }
}

</script>

The third part is getting the required data from Mysql server from PHP.

<?php

$name = $_REQUEST['txtName'];
echo getDataFromMySQL($name);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜