当前位置:网站首页>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) {
边栏推荐
猜你喜欢

4. The form with the input

面试总结 22/7/22 面试中的重点

正则笔记(2)- 正则表达式位置匹配攻略

(5) 模块与包、编码格式、文件操作、目录操作

IP access control: teach you how to implement an IP firewall with PHP

(2)Thinkphp6模板引擎**标签

MySql高级 -- 约束

如何计算地球上两点的距离(附公式推导)

DVWA靶机安装教程

Solve the problem of Zlibrary stuck/can't find the domain name/reached the limit, the latest address of Zlibrary
随机推荐
uniapp | 官方提供的map组件使用问题
点名系统和数组元素为对象的排序求最大值和最小值
PHP图片压缩到指定的大小
1.11今日学习
批量替换文件字体,简体-&gt;繁体
[symfony/mailer]一个优雅易用的发送邮件类库
微信小程序开发视频加载:[渲染层网络层错误] Failed to load media
百度定位js API
1. Beginning with PHP
1.13 学习JS
如何计算地球上两点的距离(附公式推导)
ES6介绍+定义变量+不同情况下箭头函数的this指向
(3) Thinkphp6 database
DVWA靶机安装教程
SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration
Phpstudy installs Thinkphp6 (problem + solution)
[mikehaertl/php-shellcommand] A library for invoking external command operations
What are the PHP framework?
ES6三点运算符、数组方法、字符串扩展方法
4. PHP array and array sorting