当前位置:网站首页>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) {
边栏推荐
猜你喜欢
随机推荐
TypeScript 错误 error TS2469、error TS2731 解决办法
每日五道面试题总结 22/7/21
ES6介绍+定义变量+不同情况下箭头函数的this指向
QR code generation API interface, which can be directly connected as an A tag
Add a full image watermark to an image in PHP
每日面试题 2022/7/28
v-bind用法:类动态绑定对象 数组 style样式 及函数方法
TCP通信程序
4. PHP array and array sorting
What are the PHP framework?
正则笔记(1)- 正则表达式字符匹配攻略
PHP入门(自学笔记)
[symfony/finder]最好用的文件操作库
4.14到新公司的一天
Function hoisting and variable hoisting
SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration
The Error in the render: "TypeError: always read the properties of null '0' (reading)" Error solution
MySql Advanced -- Constraints
npm --package.json---require
meime module







![[league/climate] A robust command-line function manipulation library](/img/ce/39114b1c74af649223db97e5b0e29c.png)

