Forum Moderators: coopster
so far on page one it takes word from text box and produces search on datebase for that word then produces correctly over the folling pages using pagination. question is i want it to now perform search onto words and display the 2 words. code is below. :_
$carrymake = (isset($_POST['carrymake']))? $_POST['carrymake'] : $_GET['carrymake'];
$carrymodal = (isset($_POST[carrymodal ]))? $_POST[carrymodal ] : $_GET[carrymodal ];
i want to know now how to include the second varible in this code here:-
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prev.'&carrymake='.$carrymake.'"><<Previous</a> ';
}
thanks for any help
on page 1 there is two 2 select boxs
code im using to get varible for pagination is
// Get the search term into a variable.
// It could be $_GET or $_POST, so use a shorthand if/else
if (isset($_POST['myselect_1'])){
$carrymake = $_POST['myselect_1'];
$carrymodal = $_POST['myselect_2'];
} else {
$carrymake = $_GET['myselect_1'];
$carrymodal = $_GET['myselect_2'];
}
can someone tell me why im recieving an error
Notice: Undefined index: myselect_1 in C:\Inetpub\wwwroot\carpound\testpage\eg.php on line 25
what code shall i use
echo "\$_POST['myselect_1'] = '$_POST['myselect_1']'<br>\n";
echo "\$_GET['myselect_1'] = '$_GET['myselect_1']'<br>\n";
error i get is
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in testpage/eg.php on line 33
code is below
first line is line 33
while($row = mysql_fetch_array($sql)){
print '
<table width="570" border="0" class=setb>
<tr>
<td valign="middle" rowspan="2" bgcolor=EDEDED width="50" class=blackb >'.$row['make'].'</td><td>'.$row['model'].'</td>
</tr>
</table>
';
}
$sql = "SELECT ... ";
$rows = mysql_query($sql);
if (mysql_num_rows [php.net]($rows) > 0) {
// process my result set
} else {
// no records to show
}