Results link - min value in link

5 posts by 2 authors in: Forums > CMS Builder
Last Post: June 19, 2008   (RSS)

By rjbathgate - June 19, 2008

Hi again,

I want a create a link (e.g. for a popular search) which displays results with a minimum price, but can't get it to work...

<p><a href="results.php?price=1,000,000">Property over &pound;1,000,000</a></p>
<p><a href="results.php?price_min=2,000,000">Property over &pound;2,000,000</a></p>


So in the above the first one simply gives me results when price is exactly 1,000,000... whereas the second (price_min_ doesn't work - just gives me all results.

The price_min works fine in my search engine, but not on this direct link.

Is there something i'm missing?

Thanks in advance,

Rob

Re: [rjbathgate] Results link - min value in link

By Dave - June 19, 2008

Hi Rob,

Try the numeric search ranges are picky - they don't understand commas. Try removing the commas from the link and let me know if that fixes it.

<p><a href="results.php?price_min=1000000">Property over &pound;1,000,000</a></p>
<p><a href="results.php?price_min=2000000">Property over &pound;2,000,000</a></p>

Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Results link - min value in link

By rjbathgate - June 19, 2008

Hi Dave,

Thanks for the reply.

Without the commas, it does and doesn't work...

The prices set within the records DO have commas (i.e. displaying as 2,000,000). So when searching:

<p><a href="results.php?price_min=1000000">Property over &pound;1,000,000</a></p>

...because we're not using commas in the price_min in the link, it displays no results, because the results records DO have commas.

The commas work fine in a select search engine, for example:

<select name="price_min">
<option value="1,000,000">1,000,000</option>
</select>


We want to keep the commas in displayed records as otherwise we're loosing the neatness and style.

If the direct link won't work with commas, I guess I would need to build the direct link in as a form - a hidden <select> field (to take the price_min with commas) with a submit button which is just the link text - so there probably is a way around it, but not as easy or simple as a quick link...

Cheers
Rob

Re: [Dave] Results link - min value in link

By rjbathgate - June 19, 2008

Ah ha, have figured it...

It works when there is just one comma, for example:

<p><a href="results.php?price_min=900,000">Property over &pound;900,000</a></p>

but not when there is more than one, for example:
<p><a href="results.php?price_min=2,000,000">Property over &pound;2,000,000</a></p>

So I think i'll resort to price being number only (no commas) and then using number_format() - more ability to restrict field entry in CMS too by just allow numbers.

Cheers for your help - strange how 1 comma works!

Rob