I have this for loop that posts a GET when the user clicks a page number link it should take them
to the right page number.
It works except the php page has a search box and so I don't need a GET I need a post so when I click the link it can't find the url in the POSTED list from the search box coming back from the sql query. I have sessions so is there a way to turn the GET into a POST? Otherwise it returns to the first page and the sql query to be paged is in the POST on the page. If the number the user clicked was posted then it should divide the resulting rows into pages.
thanks,
$noPages=$_SESSION('recs']/500;
for ($p=1;$p<=$noPages;$p++ ){
echo " <a href='myphp.php'?page=$p'>$p</a>\n";
I tried to convert it into a form with a hidden field
$noPages=$_SESSION['recs']/500;
//for ( $p=1;$p<=$noPages;$p++ ) {
echo "<form name='myform' action='http://www.mydomain.com/myformhandler.cgi' method='POST'>";
echo "<div align='center'>";
echo " <a href='print_labels_form.php?page=$p'>$p</a>\n";
echo " <input type='hidden' name='page' value=$p>";
echo "<br /><br />";
echo "</div>";
echo "</form>";
but don't know where to put it in the for loop to get the right page number when it is clicked on. Also, this code is in the WHILE of a SQL query.