Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Search FIltering

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Search FIltering

Postby ychan20 » Mon Feb 18, 2013 10:23 pm

Hi Guys

Any one knows here how to filter by search?

i had a search header and here is my code i wanted that the state/city that will have a dropdown menu and instead of search box. and how can i make it? i was really gotting some head ache with this one...
thanks

i also attached the screenshot about what i am talking.

<?php
session_start();
error_reporting(0);
/*session_cache_expire( 20 );
session_start(); // NEVER FORGET TO START THE <strong class="highlight">SESSION</strong>!!!
$inactive = 10;
if(isset($_SESSION['pstart']) ) {
$session_life = time() - $_SESSION['pstart'];
if($session_life > $inactive){
header("Location: logout.php");
}
}
$_SESSION['pstart'] = time();*/

include "includes/db_connect.php";

//include "http://www.professionalclassifiedscript.com/classifiedscript/includess/db_connect.php";

//print_r($_SESSION);

function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

function curPageName()
{
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}

//echo "The current page name is ".curPageName();

$pagename=curPageName();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<META Name="description" Content="<?php echo $webdes;?>">
<META Name="keywords" Content="<?php echo $webkeyword;?>">
<title><?php echo $title;?></title>
<!--<link rel="stylesheet" href="css/global.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/sexyalertbox.css" type="text/css" media="all" />-->
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/search.js"></script>
<link href="css/dcaccordion.css" rel="stylesheet" type="text/css" />
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>-->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type='text/javascript' src='js/jquery.cookie.js'></script>
<script type='text/javascript' src='js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='js/jquery.dcjqaccordion.2.7.min.js'></script>
<!--<script src="js/mootools.js" type="text/javascript"></script>
<script src="js/sexyalertbox.packed.js" type="text/javascript"></script>-->
<script type="text/javascript">
$(document).ready(function($){
$('#accordion-1').dcAccordion({
eventType: 'click',
autoClose: true,
saveState: true,
disableLink: true,
speed: 'slow',
showCount: true,
autoExpand: true,
cookie : 'dcjq-accordion-1',
classExpand : 'dcjq-current-parent'
});
$('#accordion-2').dcAccordion({
eventType: 'click',
autoClose: false,
saveState: true,
disableLink: true,
speed: 'fast',
classActive: 'test',
showCount: true
});
$('#accordion-3').dcAccordion({
eventType: 'click',
autoClose: false,
saveState: false,
disableLink: false,
showCount: false,
speed: 'slow'
});
$('#accordion-4').dcAccordion({
eventType: 'hover',
autoClose: true,
saveState: true,
disableLink: true,
menuClose: false,
speed: 'slow',
showCount: true
});
$('#accordion-5').dcAccordion({
eventType: 'hover',
autoClose: true,
saveState: true,
disableLink: true,
menuClose: true,
speed: 'fast',
showCount: false
});
$('#accordion-6').dcAccordion({
eventType: 'hover',
autoClose: false,
saveState: false,
disableLink: false,
showCount: false,
menuClose: true,
speed: 'slow'
});
});
function Viewcategory_products(val)
{
window.location="viewproducts.php?catid="+val;
}

</script>


<link href="css/skins/blue.css" rel="stylesheet" type="text/css" />
<link href="css/skins/graphite.css" rel="stylesheet" type="text/css" />
<link href="css/skins/grey.css" rel="stylesheet" type="text/css" />

</head>
<body>
<center>
<div class="wholesite">

<!--top part-->
<div class="top-part"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="120" align="left" valign="middle"><a href="index.php"><img src="<?php echo $logo_url; ?>" width="263" height="81" border="0" /></a></td>
<td align="right" valign="top">
<?php
if((isset($_SESSION['user_id'])) && (isset($_SESSION['user_type'])) && (isset($_SESSION['user_fname'])) && (isset($_SESSION['user_lname'])) && (isset($_SESSION['user_email'])) && (isset($_SESSION['user_status'])))
{
$regdirect="#";
$bannerimage="images/banner3.png";
?>

<div class="top-menu">
<div align="right">Welcome, <span><?php echo $_SESSION['user_name']; ?></span> &nbsp;&nbsp;| <a href="myaccount.php" <?php if($pagename=="myaccount.php") { ?> class="active" <?php }?> >My Account</a>&nbsp;&nbsp;| <a href="logout.php">Logout</a></div>
</div>
<div align="right">
<?php
}
else
{
$regdirect="register.php";
$bannerimage="images/banner.png";
?>

</div>
<div class="top-menu">
<div align="right">Welcome,<span> Guest</span> &nbsp;&nbsp;| <a href="signin.php" <?php if($pagename=="signin.php") { ?> class="active" <?php }?>>Login</a> | <a href="register.php" <?php if($pagename=="register.php") { ?> class="active" <?php }?>>Register</a> </div>
</div>
<div align="right">
<?php
}
?>
<!--menu-->
</div>
<div class="menu">
<ul>
<!--<li><a href="index.php" <?php if($pagename=="index.php") { ?> class="active" <?php }?> >Home</a></li>-->
<li><a href="rental_listing.php" <?php if($pagename=="rental_listing.php") { ?> class="active" <?php }?>>Home</a></li>
<li><a href="itempost.php" <?php if($pagename=="itempost.php") { ?> class="active" <?php }?>>List Item</a></li>
<li><a href="advance_search.php" <?php if($pagename=="advance_search.php") { ?> class="active" <?php }?>>Search</a></li>
<li><a href="howitworks.php" <?php if($pagename=="howitworks.php") { ?> class="active" <?php }?>>How It Works</a></li>
<li><a href="faq.php" <?php if($pagename=="faq.php") { ?> class="active" <?php }?>>FAQ</a></li>
</ul>
</div>
<!--menu-->
</td>
</tr>
</table>
</div>
<!--top part-->

<!--menu-->
<!--<div class="menu">
<ul>
<li><a href="index.php" <?php if($pagename=="index.php") { ?> class="active" <?php }?> >Home</a></li>--> <!--
<li><a href="rental_listing.php" <?php if($pagename=="rental_listing.php") { ?> class="active" <?php }?>>Home</a></li>
<li><a href="itempost.php" <?php if($pagename=="itempost.php") { ?> class="active" <?php }?>>Post List</a></li>
<li><a href="advance_search.php" <?php if($pagename=="advance_search.php") { ?> class="active" <?php }?>>Search</a></li>
<li><a href="howitworks.php" <?php if($pagename=="howitworks.php") { ?> class="active" <?php }?>>How It Works</a></li>
<li><a href="faq.php" <?php if($pagename=="faq.php") { ?> class="active" <?php }?>>FAQ</a></li>
</ul>
</div>-->
<!--menu-->

<!--banner-->
<form action="advance_search.php" name="adv_search" id="adv_search" method="post">
<fieldset style="border:solid 0px #848484;">
<!--<legend><font style="font-weight:bold; color:#f95e00;"> Advance Search Options</font></legend> -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding:5px 5px 5px 5px;">
<tr>
<td width="11%" align="left" valign="middle"><div align="right"><b>Product Name </b></div> <div align="right"></div></td>
<td width="1%" align="left" valign="middle">&nbsp;</td>
<td width="21%" align="left" valign="top"><input type="text" name="adv_searchtxt1" id="adv_searchtxt1" class="search-input" size="20px" onkeypress="clr_advsearcherr();" /></td>
<td width="1%">&nbsp;</td>
<td align="left" valign="middle"><b>Renter Type</b></td>
<td align="left" valign="middle">&nbsp;</td>
<td width="21%" align="left" valign="top"><select name="product_rentertype" id="product_rentertype" style="width:180px;" class="product-input" onchange="clr_advsearcherr();" >
<option value='0'>---- Select Renter Type ---------</option>
<option value='1'>Individual</option>
<option value='2'>Company</option>
</select></td><td width="1%" align="left" valign="middle">&nbsp;</td>
<td width="10%" align="left" valign="middle"><div align="right"><b>Price </b></div></td>
<td width="1%" align="left" valign="middle">&nbsp;</td>
<td colspan="3" align="left" valign="top"><input type="text" name="product_minprice" id="product_minprice" onblur="Trim(this.id);" value="" size="7" style="border:solid 1px #E0E0E0;" />
&nbsp;&nbsp;
<input type="text" name="product_maxprice" id="product_maxprice" onblur="Trim(this.id);" value="" size="7" style="border:solid 1px #E0E0E0; " /></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
<td colspan="3">&nbsp;</td>
<td>&nbsp;<td width="8%" colspan="6" align="center"><div align="left">
<input type="image" src="images/search-but.png" name="prdt_advsearch" id="prdt_advsearch" onclick="return validate_advsearch();" />
</div></td>
</tr>
<tr>
<td height="22" align="left" valign="middle"><div align="right"><b>Category </b></div></td>
<td height="22" align="left" valign="middle">&nbsp;</td>
<td width="21%" align="left" valign="top"><select name="product_category" id="product_category" style="width:180px;" class="product-input" onchange="list_subcategory2(this.value);clr_advsearcherr();">
<?php
$sel_qry=mysql_query("select * from ecom_category where ecat_status=0");

$count=mysql_num_rows($sel_qry);

if($count>0)
{
echo "<option value='0'>------Select category------</option>";
while($row=mysql_fetch_array($sel_qry))
{
echo "<option value='$row[ecat_id]'>$row[em_category]</option>";
}
}
else
{
echo "<option value=''>No categories found</option>";
}

?>
</select></td>
<td width="1%">&nbsp;</td>
<td width="9%" align="left" valign="middle"><b>Sub-category </b></td>
<td width="1%" align="left" valign="middle">&nbsp;</td>
<td align="left" valign="top" id="subcatlist"><select name="product_subcategory" id="product_subcategory" style="width:180px;" class="product-input" onchange="clr_advsearcherr();" >
<!-- <option value='0'>---------- Select Subcategory ---------</option> -->
<?php
$subsel_qry=mysql_query("select * from ecom_subcategory where esubcat_status=0");

$subcount=mysql_num_rows($subsel_qry);

if($subcount>0)
{
echo "<option value='0'>------Select Subcategory------</option>";
while($row2=mysql_fetch_array($subsel_qry))
{
echo "<option value='$row2[esubcat_id]'>$row2[em_subcategory]</option>";
}
}
else
{
echo "<option value=''>No Subcategories found</option>";
}

?>
</select><td align="left" valign="middle">&nbsp;</td>
<td align="left" valign="middle"><div align="right"><b>State/City </b></div></td>
<td align="left" valign="middle">&nbsp;</td>
<td width="15%" align="left" valign="top"><input type="text" name="adv_searchtxt3" id="adv_searchtxt3" class="search-input" size"20px" onkeypress="clr_advsearcherr();" /></td><td colspan="6" align="center">&nbsp;</td>
</tr>
</table>
<!--banner-->
Attachments
filter search.PNG
filter search.PNG (13.47 KiB) Viewed 709 times
ychan20
New php-forum User
New php-forum User
 
Posts: 5
Joined: Mon Feb 04, 2013 4:44 pm

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.