PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
echo "<form method=POST'' action=''> ";
echo "Enter Search word then click Search!: <input type='text' name='searchtext'> ";
echo "<input type='SUBMIT' value='Search'> ";
echo "</form> ";
// Connection Details
mysql_connect($host,$username,$password) or die("Cannot connect to the database.<br>" . mysql_error());
mysql_select_db($database) or die("Cannot select the database.<br>" . mysql_error());
if(!isset($page)) {
$page = 0;
}
$limit = 5; // Entries per page
if ( $searchtext == "" ){
$sql = "SELECT SaleNumber,LotNo,Description,LowEst,HighEst,Image FROM $table ORDER BY LotNo LIMIT $page,$limit";
} else {
$sql = "SELECT SaleNumber,LotNo,Description,LowEst,HighEst,Image FROM $table WHERE Description LIKE '%$searchtext%' ORDER BY LotNo LIMIT $page,$limit";
}
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
// Retrieve Data and output to table etc etc
// Next/Previous page Code
?>
My question is that i need a reset button to effectively get out of the refresh the page as if no search text had been entered i.e. the page loads up showing the first 1 to 5 sale items again.
<?php
echo '<form action="'.$_SERVER['PHP_SELF'].'"><input type="submit" text="Refresh Page" method="POST"></form>'; // POST, so it has a pretty URL
?>
That works, but don't do it like that, there but be FAR better ways.