Home >Backend Development >PHP Tutorial >Ask a question about pagination
This paging is based on the query condition of $name. I would like to ask if the link to the page number of this paging is hard-coded during the first query? For example, when clicking on the second page, the query condition $name was not submitted. If the following if judgment is used, wouldn't $name be empty? There is no way to click on the second page. Is it like what I said at the beginning that the URLs of all page numbers have been generated during the first query, so there is no need to query based on the query conditions?
<code>$name = isset($_REQUEST['name'])? $_REQUEST['name'] : ''; $page = isset($_REQUEST['page'])? $_REQUEST['page'] : 1;</code>
<code>'<li"><a href="'.$_SERVER["SCRIPT_NAME"].'?page='.$i.'&name='.$name.'">'.($i).'<a></li>'</code>
This paging is based on the query condition of $name. I would like to ask if the link to the page number of this paging is hard-coded during the first query? For example, when clicking on the second page, the query condition $name was not submitted. If the following if judgment is used, wouldn't $name be empty? There is no way to click on the second page. Is it like I said at the beginning that the URLs of all page numbers have been generated during the first query, so there is no need to query based on the query conditions?
<code>$name = isset($_REQUEST['name'])? $_REQUEST['name'] : ''; $page = isset($_REQUEST['page'])? $_REQUEST['page'] : 1;</code>
<code>'<li"><a href="'.$_SERVER["SCRIPT_NAME"].'?page='.$i.'&name='.$name.'">'.($i).'<a></li>'</code>
Yes, it is generated on the first query
You can use paging controls.