jquery php Baidu search box Smart Tips effect

Source: Internet
Author: User
Tags mysql tutorial phpmyadmin

This program is the use of php+ajax+jquery implementation of a imitation Baidu smart hints, the need for friends can download test Oh.

The code is as follows

index.html file, Save as Index.htm


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">php file

<?php     mysql tutorial _connect (' localhost ', ' root ', ' root '); mysql_select_db ("AutoComplete");   $queryString = $_post[' queryString ');      if (strlen ($queryString) >0) {    $sql = "Select value from countries WHERE value is like '". $queryString. " % ' LIMIT ten ';    $query = mysql_query ($sql);    while ($result = Mysql_fetch_array ($query, Mysql_both)) {          $value = $result [' value '];     Echo ' <li onclick= ' Fill ('. $value. '); " > '. $value. ' </li> ';    }   }  ? >
Sql.sql Copy This here and save it to yourDatabase Tutorials
--phpMyAdmin SQL dump--version 3.3.5--http://www.phpmyadmin.net----Host: localhost--generated date: December 09, 2010 02:36--Server Edition Ben: 5.0.22--PHP version: 5.2.14SET sql_mode= "No_auto_value_on_zero";/*!40101 SET @[email protected] @CHARACTER_SET_ CLIENT */;/*!40101 set @[email protected] @CHARACTER_SET_RESULTS */;/*!40101 set @[email protected]@ Collation_connection */;/*!40101 SET NAMES UTF8 */;----database: ' autoComplete '------------------------------------------ The structure of the----------------------table ' countries '--create table IF not EXISTS ' countries ' (' ID ' int (6) is not NULL auto_increment, ' Value ' varchar ' not NULL default ', PRIMARY KEY (' id ')) engine=myisam default Charset=latin1 auto_increment=243;-- --Dump the data in the table ' countries '--insert into ' countries ' (' id ', ' value ') VALUES (1, ' Afghanistan '), (2, ' Aringland Islands '), (3, ' Al Bania '), (4, ' Algeria '), (5, ' American Samoa '), (6, ' Andorra '), (7, ' Angola '), (8, ' Anguilla '), (9, ' Antarctica '), (10, ' Antigua and Barbuda '), (one, ' Argentina '), (A, ' Armenia '), (13, ' Aruba '), (+, ' Australia '), (+, ' Austria '), (+, ' Azerbaijan '), (+, ' Bahamas '), (+, ' Bahrain '), (+, ' Bangladesh '), ( , ' Barbados '), (+, ' Belarus '), (+, ' Belgium '), (+, ' Belize '), (+, ' Benin '), (+, ' Bermuda '), (+, ' Bhutan '), (27, ' Bolivia '), (Bosnia and Herzegovina '), (+, ' Botswana '), (+, ' Bouvet Island '), (+, ' Brazil '), (+), ' British Indian Ocean territory '), (Brunei Darussalam '), ("Bulgaria"), (+, ' Burkina Faso '), (+, ' Burundi '), (PNS, ' Cambodia '), (38 , ' Cameroon '), (+, ' Canada '), (+, ' Cape Verde '), (+, ' Cayman Islands '), (A, ' Central African Republic '), (+, ' Chad '), (44 , ' Chile '), (Christmas, ' China '), (+, ' Cocos (Keeling) Islands '), (+, ' Colombia '), (+, ' Comoros '), (50, ' Congo '), (Congo, ' democratic Republic '), (A-Si, ' Cook Islands '), (SI, ' Costa Rica '), (in A, ' Ivory Coast '), ("Ivory Coast '), (Croatia, ' Hrvatska '), (+, ' Cuba '), ((+), ' Cyprus '), (+, ' Czech Republic '), (+, ' Denmark '), (+, ' Djibouti '), (62 , ' Dominica '), (Dominican, ' Republic '), (+, ' East TimEthiopia '), (Falkland, ' Islands '), (the "Faroe Islands"), ("The", "Fiji"), (A, ' Finland '), (+, ' France '), ("The"), (a), "French Guiana '), (+, ' French Polynesia '), (+, ' French Southern Territories '), (+, ' Gabon '), (Bayi, ' Gambia '), (83, ' Georgia '), , ' Germany '), (+ (), ' Ghana '), (+, ' Gibraltar '), (the "Greece"), (the "Greenland"), (the "(), ' the '"), ("The", ' Grenada '), (90, ' Guadeloupe '), ' Guam '), (Guatemala, ' Guinea '), (the "Guinea-Bissau"), ("94, ' Guyana '), (the" (), ' the ' Haiti '), (a. Islands '), ("Honduras"), (98, ' Hong Kong '), (the "Hungary"), (+, ' Iceland '), (101, ' India '), (102, ' Indonesia '), (103, ' Iran '), (104, ' Iraq '), (the "Ireland"), (106, ' Israel '), (107, ' Italy '), (108, ' Jamaica '), (109, ' Japan '), (+, ' Jordan ') , (111, ' Kazakhstan '), (the "Kenya"), (113, ' Kiribati '), (the "Korea"), ("A," (), ((), ' Korea (South) '), (with the (), ' Kuwait '), ( 117, ' Kyrgyzstan '), (118, ' Lao people ' s Democratic Republic '), (119, ' Latvia '), (+, ' Lebanon '), (121, ' Lesotho '), (122, ' Liberia '), (123, ' Libyan Arab Jamahiriya '), (124, ' Liechtenstein '), ("Lithuania"), (126, ' Luxembourg '), (127, ' Macao '), (+, ' Macedonia '), (129, ' Madagascar '), (130, ' Malawi '), (131, ' Malaysia '), ("Maldives"), (133, ' Mali '), (134, ' Malta '), (135, ' Marshall Islands '), (136, ' Martinique '), (137, ' Mauritania '), (138, ' Mauritius '), (139, ' Mayotte '), ([Mexico], ' 141 '), (+ 142, ' Micronesia '), Moldova '), (143, ' Monaco '), (144, ' Mongolia '), (145, ' Montserrat '), (146, ' Morocco '), (147, ' Mozambique '), (148, ' Myanmar '), ), (149, ' Namibia '), (Nepal, ' Nauru '), (151, ' Netherlands '), (153, ' Netherlands '), (a), and (the "New", "Antilles, 154") Caledonia '), (155, ' New Zealand '), (156, ' Nicaragua '), (157, ' Niger '), (158, ' Nigeria '), (159, ' Niue '), (A., ' Norfolk ') Island '), (161, ' Northern Mariana Islands '), (162, ' Norway '), (163, ' Oman '), (164, ' Pakistan '), (165, ' Palau '), (166, ' Palestinian territories '), (167, ' Panama '), (168, ' Papua New Guinea '), (169, ' Paraguay '), (in the ' Peru '), (171, ' Philippines '), (172, ' Pitcairn '), (173, ' Poland '), (174, ' Portugal '), (175, ' Puerto Rico '), (176, ' Qatar '), (177, ' runion '), ), (178, ' Romania '), (179, ' Russian Federation '), (the "Rwanda, '" 181 '), (and "Saint Helena"), (182, ' Saint Kitts and Nevis '), (183 , ' Saint Lucia '), (184, ' Saint Pierre and Miquelon '), (185, ' Saint Vincent and the Grenadines '), (186, ' Samoa '), (187, ' San Ma Rino '), (188, ' Sao Tome and Principe '), (189, ' Saudi Arabia '), (Senegal, ' 191 '), (, ' Serbia and Montenegro '), (192, ' Seyche Lles '), (193, ' Sierra Leone '), (194, ' Singapore '), (195, ' Slovakia '), (196, ' Slovenia '), (197, ' Solomon Islands '), (198, ' Somalia '), (199, ' South Africa '), ($, ' South Georgia and the South Sandwich Islands '), (201, ' Spain '), (202, ' Sri Lanka '), (2 , ' Sudan '), (204, ' Suriname '), (205, ' Svalbard and Jan Mayen Islands '), (206, ' Swaziland '), (207, ' Sweden '), (208, ' Switzerland '), (209, ' Syria '), ("Taiwan"), (211, ' Tajikistan '), (212, ' Tanzania '), (213, ' Thailand '), (214, ' Togo '), ( 215, ' Tokelau '), (216, ' Tonga '), (217, ' Trinidad and TObago '), (218, ' Tunisia '), (219, ' Turkey '), (+/-Turkmenistan '), (221, ' Turks and Caicos Islands '), (222, ' Tuvalu '), (223, ' Uganda '), (224, ' Ukraine '), (225, ' the Arab Emirates '), (226, ' the ' Kingdom '), (227, ' states of America '), (228, ' Uruguay '), (229, ' Uzbekistan '), (+, ' Vanuatu '), (231, ' Vatican City '), (232, ' Venezuela '), (233, ' Vietnam '), (234, ' Virgin Islands (British) '), (235, ' Virgin Islands (US) '), (236, ' Wallis and Futuna Islands '), (237, ' Western Sahara '), (238, ' Yemen '), (239, ' Zaire '), (+, ' Zambia '), (241, ' Zimbabwe ');
Note: There's a jquery file inside .

jquery php Baidu search box Smart Tips effect

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.