Today, I encountered a problem, which was a little embarrassing, because I had not used PHP for a long time, so I was not familiar with Smarty, at first I thought it was a front-end HTML problem. Here, there is a retrieval function, after the input of the retrieval information, once the retrieval is triggered, it will jump to the retrieval result, but the retrieval condition information is regulated as initialized.Copy the code

The problem is how to make it not put the default value, the general idea is two: 1. Use Ajax technology to achieve data without refreshing the page; 2. 2. Refresh the page to get data! Unfortunately, the first one is too superior for xiaobai (although I also can't do the second one), by comparison, the second one is easy to learn. So I tried to modify it.Copy the code

This is the front-end HTML template source ~ ~ ~

In contrast, two condition boxes, the first is selected, the second is typed, and the second is easier to implement.



Of course, we need to add a function to pass the value in the background:

But the second one was more troublesome, half done.

At first, a function was written in the background to get the category name, which can be called by the front end.



But the effect was unexpected… It’s just not what I was expecting.

In theory, the end result should be something like this.



This is awkward, and then through all kinds of experiments, ultimately can not achieve the desired effect. Dropdown menu contents vary, but the check box is the same position.

After consulting a friend in the group, I found a solution and added a judgment to the

$_GET = $_GET = $_GET

If you don’t want to use $_GET to pass the parameter, you can also write a function that passes the parameter forward in the background.

That is:

In this way, the problem is solved, ah, after the problem is solved, the feeling is not so difficult as I imagined! The key is that they did not learn. The front end still needs to learn, otherwise development is really difficult to die… Smarty also needs to be used and mastered

There is a sentence that is not bad: learning without thinking is forgotten, thinking without learning is meng force, so also!