0
我有很多選擇的選項,我分頁顯示每頁5選擇選項,並能正常工作像這樣如何檢索通過分頁的頁面中的所有選擇的選項提交表單的PHP
<form method="post" action="sel.php">
<?php
---------------------------------
//Pagination script here
----------------------------------------
//Here, I retrieve some values from database
$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))
{
//Here, I display the select option while the above values are retrived
echo "<div align='center'><span class='style3'>{$row['home']} VS ".
"{$row['away']} </span></div>".
"<font color='#000000' size='2'>{$row['country']} | {$row['league']} | Time:{$row['starttime']} </font> <br> ".
"<select name='gm[$row[gamecode]|$row[starttime]|$row[home]|$row[away]]' >
<option value=''>Select option</option>
<option value='1.80 01 Both Team to Score (YES)'>1.90 Both Team to Score (YES)</option>
<option value='1.85 02 Both Team to Score (NO)'> 1.85 Both Team to Score (NO)</option>
<option value='1.90 03 Over2.5(Total Goals)'>1.90 Over2.5(Total Goals)</option>
<option value='1.80 04 Under 2.5(Total Goals)'>1.80 Under 2.5(Total Goals)</option>
<option value='1.35 05 Over 1.5 (Total Goals)'>1.35 Over 1.5 (Total Goals)</option>
<option value='2.60 06 Under 1.5 (Total Goals)'>2.60 Under 1.5 (Total Goals)</option>
<option value='2.05 07 Draw(First Half)'>2.05 Draw(First Half)</option>
<option value='1.55 08 Either Team Win (First Half)'>1.55 Either Team Win (First Half)</option>
<option value='3.70 09 Draw(Full Time)'>3.70 Draw(Full Time)</option>
<option value='1.20 10 Either Team Win (Full Time)'>1.20 Either Team Win (Full Time)</option>
<option value='1.90 11 Even(Total Goals)'>1.90 Even(Total Goals)</option>
<option value='1.90 12 Odd(Total Goals)'>1.90 Odd(Total Goals)</option>
</select>".
"<hr>";
}//end While
------------------------------
$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
-----------------------------------
?>
<br /><input type="submit" name="play" value="Calculate Bet" />
</form></div>
這裏是後問題,如果用戶在第1頁上選擇任意數量的選項,然後單擊第2頁,並選擇第2頁上的選項,則在第3頁上選擇任何內容並繼續提交表單,只有在最後選擇頁面上選擇的選項即第2頁在表單處理頁面上檢索。我如何將所有頁面中選擇的選項值傳遞給表單處理頁面,而不僅僅是最後一頁上選擇的值?
是的,我喜歡$ _GET方法在這種情況下,我已經做了許多搜索我如何將每個頁面中的所有選定選項保存到URL中 – scylla