Php+ajax to achieve Google search function two [original]

Source: Internet
Author: User

//

Original works

Original site: www.111cn.net

Author: noodles Love rabbit qq:271728967

NOTE: Reprint please explain the original out http://www.111cn.net

//
Now to talk about post.php file, post.php file is very simple, this does not necessarily use PHP can use a lot, as long as the server foot can be completed, {personal comments}

Header ("content-type:text/html;charset=gb2312"); I'm just saying that. Set the document encoding.

$key =isset ($_post[' key '])? $_post[' key ': ';
$sql = "Select title from test where title like '% $key% ' ORDER by title DESC";
$result =mysql_query ($sql) or Die (Mysql_error ());
echo "<div id=show >";
while ($rs =mysql_fetch_array ($result)) {
echo "<li onmouseover=\" this.style.background= ' #d7ebff ' "onmouseout=\" this.style.background= ' #ffffff ' " Onclick=\ "Javascript:fillin (this.innerhtml);" > "$rs [' title ']." </li> ";
}
echo "</div>";

Php+ajax to achieve Google search function two [original].

Browse Address: http://www.111cn.net/test/test.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.