我想創建一個下拉列表,限制每頁顯示的圖像數量,並允許用戶決定要顯示多少圖片,默認情況下我已設置5我試圖搜索淨我不設法想出這裏的解決方案是我試圖下拉列表和php
<form action="image_search.php" name="formSize" method="post">
<span id="PageSize" style="color:Gray;">Page Size:</span>
<select name="pagesize">
<option selected="selected" value="5">5</option>
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
<span id="Title" style="color:Gray;"></span>
</form>
<?php
include_once("includes/images.php");
$xml = simplexml_load_file("xml/images.xml"); //load the images
$page = 0;
if (isset($_POST['formSize']))
{
$varSize = $_POST['pagesize'];
}
$MAXELEMENTSPERPAGE = $varSize; //change this value to display how many elements per page you wish people to see
$maxPage = count($xml)/$MAXELEMENTSPERPAGE;
if(isset($_GET['page']))
{
$page = $_GET['page']; //if page is specif
}
?>
如果我刪除$ varSize並與多家它的工作原理,但正如我得到這個錯誤 未定義的變量替換代碼:varSize
你如何發佈數據,formSize來自哪裏? – Musa 2013-03-01 22:13:23