当前位置:网站首页>PHP实现搜索框的自动反查提示
PHP实现搜索框的自动反查提示
2022-08-02 03:24:00 【producing】
通过PHP连接到MySQL数据库我们可以简易查到数据并返回给页面,仅用PHP和HTML做显示数据通常最方便常用的办法就是table,但是如果需要一些更人性化的页面设计,往往会有一些页面用到jquery或者其他的前端数据处理技术,结合网上一些资料,今天做出来一个最基础的关于数据库反查并显示数据库与搜索框输入文本关联数据的提示功能(非百度搜索框的预测提示)。
echo"Show you the code:"
1、首先我们要有一个搜索界面(searchimprove.html)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Search For</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$("input").keyup(function(){
txt=$("input").val();
$.post("search.php", {suggest: txt}, function(data){
if(data.length >0) {
边栏推荐
猜你喜欢
(2) Thinkphp6 template engine ** tag
The Error in the render: "TypeError: always read the properties of null '0' (reading)" Error solution
What are the PHP framework?
TCP通信程序
SQL: DDL, DML, DQL, DCL corresponding introduction and demonstration
(1)Thinkphp6入门、安装视图、模板渲染、变量赋值
[league/climate] A robust command-line function manipulation library
阿里云设置域名解析重定向后,无法使用Chrome访问
MySql Advanced -- Constraints
如何根据地图上的两个坐标点来确定方向
随机推荐
数组的高级操作
简单黑马头条项目
uniapp | 使用npm update更新后编译报错问题
Batch replace file fonts, Simplified -> Traditional
阿里云服务器如何使用admin账户登录
5.20今日学习
[mikehaertl/php-shellcommand]一个用于调用外部命令操作的库
4.14到新公司的一天
js 正则中 replace() 使用
uniapp | 开发中遇到的兼容性问题(待续)
攻防世界—MISC 新手区1-12
Query the indexes of all tables in the database and parse them into sql
(1)Thinkphp6入门、安装视图、模板渲染、变量赋值
1. Beginning with PHP
1.8今日学习
6.27面试集
宝塔邮局邮箱设置成功后能发送不能接收问题处理
17.JS条件语句和循环,以及数据类型转换
使用PHPMailer发送邮件
如何计算地球上两点的距离(附公式推导)