My now code:
HTML:
<form action="bans.php?screen=search" method="post">
<select name="typ">
<option>first</option>
<option>second</option>
</select>
<input name="search_type" type="input" maxlength="20" />
<input type="submit" value="search!" name="spr"><br />
</form>
AND PHP:
if($_POST || $_GET)
$submit = isset($_GET['spr']) ? $_GET['spr'] : $_POST['spr'];
if($submit) {
if(empty($submit)) {
header("Location: bans.php?action=search");
exit();
}
}
$method = isset($_GET['typ']) ? $_GET['typ'] : $_POST['typ'];
$bantype = isset($_GET['search_type']) ? $_GET['search_type'] : $_POST['search_type'];
$result = mysql_query("SELECT COUNT(`" . $method . "`) AS `ilosc` FROM `" . $config['DB_PREFIX'] . "bans` WHERE `" . mysql_real_escape_string($method) . "` LIKE '%" . mysql_real_escape_string($bantype) . "%'
;");
$ile = mysql_fetch_assoc($result);
$pages = ceil($ile['ilosc']/10);
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
if($page > $pages || $page < 1){
$page = 1;
}
If i’m on first page, displayed good, but I’m on other page this results not displayed.
In first page running form, but on the other does not work anymore…
first page = $_POST, other page = $_GET?
How this do?
My code in first page displayed good, but when i’m on other page returns errors:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/myfile… on line 60