I have form with a Select option that loops like this.
<form method="post" action="consel.php">
<?php
$sql = "SELECT * FROM games WHERE startunix > '$nowtime' ORDER BY starttime LIMIT $offset, $rowsperpage" ;
$retval = mysql_query($sql);
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "<select name='gm[$row[gamecode]]' >
<option value=''>Select option</option>
<option value='01'>01</option>
<option value='02'>02</option>
<option value='03'>03</option>
<option value='04'>04</option>
</select>";
}
//Pagination Script Starts here
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'>First Page |</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'>Previous Page |</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>Next</a> ";
// echo forward link for lastpage
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>| Last</a> ";
} // end if
/****** end pagination links ******/
?>
<br /><input type="submit" name="play" value="submit" />
</form>
I do not expect the user submit form on the first page but whatever drop down option the user selects gets lost on clicking the Next Page. the form thereby submits only the selected option in the next pages without remembering the selection in the previous pages. Kindly help out