SHOW:
|
|
- or go back to the newest paste.
1 | $criteria = array('ctitle', 'csubject', 'creference', 'cat_id', 'cmaterial', 'ctechnic', 'cartist', 'csource', 'stolen'); | |
2 | $likes = ""; | |
3 | $url_criteria = ''; | |
4 | foreach ( $criteria AS $criterion ) { | |
5 | - | $value = mysql_real_escape_string($_POST[$criterion]); |
5 | + | |
6 | $value = ($_POST[$criterion]); | |
7 | $likes .= " AND `$criterion` = '%$value%'"; | |
8 | $url_criteria .= '&'.$criterion.'='.htmlentities($_POST[$criterion]); | |
9 | } elseif ( ! empty($_GET[$criterion]) ) { | |
10 | $value = mysql_real_escape_string($_GET[$criterion]); | |
11 | $likes .= " AND `$criterion` = '%$value%'"; | |
12 | - | $query = "SELECT * FROM collections WHERE c_id>0" . $likes . " ORDER BY c_id ASC"; |
12 | + | $url_criteria .= '&'.$criterion.'='.htmlentities($_GET[$criterion]); |
13 | } | |
14 | } | |
15 | $query = "SELECT * FROM collections WHERE c_id>0" . $likes . " ORDER BY c_id ASC"; | |
16 | ||
17 | // then append the $url_criteria onto any of the hrefs you need to create for pagination, e.g. | |
18 | echo '<a href="myurl.php?page=1'.$url_criteria.'" title="Page 1">Page 1</a>'; |