Jump to content

Recommended Posts

Hello friends,

 

I have Designed a Search Page with PHP and Mysql.. and i want help from you people..

 

<form name="search" action="../search.html" method="POST" target="_top">

                    <table width="100%" border="0" cellpadding="4" cellspacing="0" class="search">

                      <tr>

                        <td> </td>

                        <td align="left"><strong>Quick Search</strong><input type="hidden" name="sr_date" size="20" class="TextBox" value="<?php echo date("d-M-Y")?>" />

<input type="hidden" name="search" size="20" class="TextBox" value="Search Form" /></td>

                      </tr>

                      <tr>

                        <td width="45%">Property Type : </td>

                        <td width="55%" align="left"> <select name="property_type" class="textbox">

                            <option value="select" selected>Select</option>

                            <option value="villa">Villa</option>

                            <option value="farmhouse">Farmhouse</option>

                            <option value="city-apartment">City Apartment</option>

                            <option value="apartment">Apartment</option>

                            <option value="cottage">Cottage</option>

                          </select> </td>

                      </tr>

                      <tr>

                        <td>Region :</td>

                        <td align="left"><select name="region" class="textbox">

                            <option value="select" selected>Select</option>

                            <option value="arezzo">Arezzo</option>

                            <option value="chianti">Chianti</option>

                            <option value="florence">Florence</option>

                            <option value="florence city">Florence City</option>

                            <option value="lucca">Lucca</option>

                            <option value="siena">Siena</option>

                          </select></td>

                      </tr>..............................

 

in that you can see arezzo, chianti, florence, Florence City, Lucca, Siena and it has going to db..

i want to get the results of florence as florence=Florence City Fields 

 

 

<?

 

 

 

function getSearchList($sql)

 

{

 

global $con;

 

$search_result = array();

 

 

 

$query = "select property_type, region,pax,swimming_pool, keyword,property_id,budget,property_name,property_link,property_desc,property_image from ". TABLE_PROPERTY." $sql group by pax ";

 

 

 

$result = @mysql_query($query,$con) or die(mysql_error());

 

$i=0;

 

 

 

while ($row = mysql_fetch_array($result))

 

{

 

$search_result[$i]=$row;

 

 

 

$i++;

 

}

 

return $search_result;

 

}

 

 

 

 

 

function getPax($pax='')

 

{

 

for ($i=0;$i<=10;$i++)

 

{

 

 

 

if($selected ==$i)

 

$return .="<option value=".$i.">".$i."</option>";

 

else

 

$return .="<option value=".$i." >".$i."</option>";

 

 

 

}

 

return $return;

 

}

 

 

 

 

 

 

 

function getProperty_type($selected='')

 

{

 

global $con;

 

$return="";

 

 

 

$query = "select * from ".TABLE_PROPERTYTYPE ."";

 

$result = mysql_query($query,$con) or die(mysql_error());

 

 

 

while ($row = mysql_fetch_array($result))

 

{

 

if($selected ==$row['property_id'])

 

$return .="<option value=".$row['property_id']." Selected>".$row['property_type']."</option>";

 

else

 

$return .="<option value=".$row['property_id']." >".$row['property_type']."</option>";

 

 

 

}

 

 

 

return $return;

 

}

 

 

 

 

 

 

 

?>

 

here is my script..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.