For example, a search form searches for the corresponding name under the name field based on the id value entered by the user. How should this be queried? I will only write this little bit. I don’t know how to pass the value in tp. How to pass the value and how to receive it?
<code> $qq->field('name'); $info=$qq->select(); $this->assign('info',$info); $this->display();</code>
For example, a search form searches for the corresponding name under the name field based on the id value entered by the user. How should this be queried? I will only write this little bit. I don’t know how to pass the value in tp. How to pass the value and how to receive it?
<code> $qq->field('name'); $info=$qq->select(); $this->assign('info',$info); $this->display();</code>
html
<code><form action="{:U('Index/search')}" method="post"> <input type="text" name="name" /> <button type="submit">Submit</button> </form></code>
php
<code> public function search(){ $name=I("post.name"); $info=M("qq")->where('name like %'.$name.'%')->select(); var_dump($info); } </code>
That’s it, tp’s documentation is still very easy to understand.
<code class="php">$where['id']=123; $info=$qq->where($where)->find();</code>
For details, please refer to the manual:
http://document.thinkphp.cn/manual_3_2.html
Form submission, direct GET, POST reception, or I method
See the document
http://document.thinkphp.cn/manual_3_2.html#input_var