Home  >  Article  >  Backend Development  >  Example of how to remember status when searching in PHP_php tips

Example of how to remember status when searching in PHP_php tips

jacklove
jackloveOriginal
2018-06-25 17:07:501526browse

This article mainly introduces the method of remembering the status when searching in PHP. It analyzes the related operation skills of PHP through get parameter transfer and DOM element form to record the search status in the form of examples. It has certain reference value. Friends in need You can refer to the following

The example of this article describes the method of remembering the state when searching in PHP. Share it with everyone for your reference, the details are as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Of Search Remember state</title>
</head>
<!--方式一 模版获取GET参数方式记住条件-->
<php>
$start = $_GET[&#39;start&#39;];
$end = $_GET[&#39;end&#39;];
</php>
<!--方式二 DOM加载方式传递条件-->
<php>
$search = $_GET[&#39;search&#39;];
</php>
<script type=&#39;text/javascript&#39;>
//DOM加载结束
$(function(){
{if:$this->search}
var searchData = {echo:JSON::encode($this->search)};
for(var index in searchData)
{
$(&#39;[name="search[&#39;+index+&#39;]"]&#39;).val(searchData[index]);
}
{/if}
});
</script>
<body>
<!--方式一 模版获取GET参数方式记住条件-->
时间:<input type="text" name=&#39;start&#39; value=&#39;{$start}&#39; /> —— <input type="text" value="{$end}" name=&#39;end&#39; />
<!--方式二 DOM加载方式传递条件-->
姓名:<input name="search[username]" type="text" value="" />
电话:<input name="search[telphone]" type="text" value="" />
</body>
</html>

Additional:

In addition, it is also important to note that ordinary The GET request is in the form: http://yourWebname.com/index.php?ids=1&ids=2 You can pass the corresponding single parameter

and use the form like :http://test.tmp/index.php?ids[]=1&ids[]=2 can be passed in the form of array parameters

Articles you may be interested in:

The laravel project uses twemproxy to deploy the complete steps of redis cluster php instance

How to PHP7 Turn on Opcode to create powerful performance. Detailed explanation of php skills

PHP is based on recursive algorithm to solve the problem of rabbits giving birth to rabbits. php skills



The above is the detailed content of Example of how to remember status when searching in PHP_php tips. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn