Search.php - by Real Estate Agents & other variables

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 12, 2012   (RSS)

By csdesign - April 11, 2012

Hello! Well, I have been working on this for awhile now and I'm sure it's just something obvious that I'm missing.

Here's my search page test:
http://www.dunhamrealestateservices.com/search2.php

I can search by price, property type & state (and any combination of those 3 fields). However, I can't get an individual search for either agent to show anything by itself or in combination with another field.

For instance, I can search for price from $0 - unlimited + residential + wyoming and I get my 2 test properties. However, when I do the same search and select either one of the agent names - I get "no record found" and there should be 1 listing for each agent.

I have been able to get it to show the agent names... but that's it.

Here's my header code:

// load records
list($homepagesRecords, $homepagesMetaData) = getRecords(array(
'tableName' => 'homepages',
));


and body code:

<form method="post" action="listings.php">

<table border="0" align="center" cellpadding="6" cellspacing="0">
<tr>
<td width="95">Price </td>
<td width="214">
<select name="price_min">
<option value="0">&lt;minimum&gt;</option>
<option value="0">$0</option>
<option value="50000">$50,000</option>
<option value="75000">$75,000</option>
<option value="100000">$100,000</option>
<option value="150000">$150,000</option>
<option value="250000">$250,000</option>
<option value="500000">$500,000</option>
<option value="1000000">$1,000,000</option>
</select>
&nbsp;
<select name="price_max">
<option value="">&lt;maximum&gt;</option>
<option value="50000">$50,000</option>
<option value="75000">$75,000</option>
<option value="100000">$100,000</option>
<option value="150000">$150,000</option>
<option value="250000">$250,000</option>
<option value="500000">$500,000</option>
<option value="1000000">$1,000,000</option>
<option value="">Unlimited</option>
</select> </td>
</tr>

<tr>
<td>Type </td>
<td>
<select name="property_type">
<option value="" selected="selected">&lt;select&gt;</option>
<option value="">Any</option>
<option>Residential</option>
<option>Commercial and Business</option>
<option>Farms and Ranches</option>
<option>Lots and Land</option>
<option>Horse Properties</option>
</select> </td>
</tr>
<tr>
<td>State</td>
<td><select name="state">
<option value="" selected="selected">&lt;select&gt;</option>
<option value="">Any</option>
<option>Montana</option>
<option>Wyoming</option>
<option>Arizona</option>
<option>Hawaii</option>
</select> </td>
</tr>

<tr>
<td>Listed by </td>
<td>
<select name="createdByUserNum">
<option value="">-Select-</option>
<?php foreach($homepagesRecords as $homepages): ?>
<option value="<?php echo $homepages['num'];?>"><?php echo $homepages['fullname'];?></option>
<?php endforeach ?>
</select> </td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
<br/>


<div align="center">
<input type="submit" name="search" value=" Search Listings "/>
</div>
</form>


Thanks for the help!! Tina

Re: [Jason] Search.php - by Real Estate Agents & other variables

By csdesign - April 12, 2012

Hi Jason! Thanks!!

I was the user that created both of their homepage records so I went back in and I had already set both individual bios as being created by each individual user (agent).

I swapped out the code, but I'm still getting the same results "no listings were found". I tried searching JUST by the user also... and that brought the same result "no listings".

I checked the code from the site online:

<select name="createdByUserNum">
<option value="">-Select-</option>

<option value="
Notice: Undefined index: createdByUseNum in /hsphere/local/home/lyleandcindy/dunhamrealestateservices.com/search2.php on line 101
">Cindy Dunham</option>

<option value="
Notice: Undefined index: createdByUseNum in /hsphere/local/home/lyleandcindy/dunhamrealestateservices.com/search2.php on line 101
">Lyle Dunham</option>

</select>


Line 101 is this:

<option value="<?php echo $homepages['createdByUseNum'];?>"><?php echo $homepages['fullname'];?></option>

Any thoughts? Thanks again for your help!! T

Re: [csdesign] Search.php - by Real Estate Agents & other variables

By Jason - April 12, 2012

Hi,

ooops, there's a small typo in the code, we're missing an "r".


Try this:

<option value="<?php echo $homepages['createdByUserNum'];?>"><?php echo $homepages['fullname'];?></option>

hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Search.php - by Real Estate Agents & other variables

By csdesign - April 12, 2012

PERFECT!! thanks a ton Jason!