close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Displaying Price Range Options

Thread began 5/13/2011 6:10 am by A Sound Design | Last modified 5/20/2011 1:48 pm by Jason Byrnes | 2370 views | 29 replies |

A Sound Design

Displaying Price Range Options

On my page I am trying to create a list of values that a customer can choose between so that they can filter records from the Recordset based upon a price range such as:

Up to £500

Up to £700

Up to £900

Up to £1500

Up to £2500

I can get this to work using the SQL statement

SELECT * FROM content WHERE Price > 0 AND Price < 500

This works fine but I'm sure there's a better way of doing it rather than creating 5 different recordsets, one for each price range.

Sign in to reply to this post

Jason ByrnesWebAssist

create a select list that passes the price as the value, for example:
<select name="maxPrice" id="maxPrice">
<option value="500">Up to 500</option>
<option value="700">Up to 700</option>
etc...
</select>

the forms method should be set to post.

then in the recordset go to advanced view, set the SQL as:

SELECT * FROM content WHERE Price > 0 AND Price < paramMaxPrice

Next, create a parameter:
Name: paramMaxPrice
Type: Number
Default value: -1
Run Time value: $_POST['maxPrice']

Sign in to reply to this post

A Sound Design

Originally Said By: Jason Byrnes
  Next, create a parameter:
Name: paramMaxPrice
Type: Number
Default value: -1
Run Time value: $_POST['maxPrice']  



I've got a bit lost at this point. Where do I create the parameter? Is it linked to what happens once the 'Search' button is pressed on the select list form?

Sign in to reply to this post

Jason ByrnesWebAssist

you create the parameter in the parameter section of the advanced recordset view.

Sign in to reply to this post

A Sound Design

Thanks. I was confused by you using the term parameter. In Dreamweaver CS4 it is 'Variable'.

Not quite sure what this is supposed to be showing as I have created the recordset and form but when I click Search it does not return anything. I've been at this for hours so maybe I'm just a bit tired. Should it be posting to a separate page? The Action of the form is blank at the moment. I was hoping that it would just filter the records on the page and show only those that are in each price range. Is that what it is supposed to do?

Thanks for your help so far.

Sign in to reply to this post

Jason ByrnesWebAssist

Not sure when they changed that, It used to be parameter, sorry for the confusion.

send a copy of your page please.

Sign in to reply to this post

A Sound Design

Originally Said By: Jason Byrnes
  Not sure when they changed that, It used to be parameter, sorry for the confusion.

send a copy of your page please.  



Zip of page attached. Btw, is it safe to put code of a whole page up here? Technically anyone could download it. Am I correct? Just don't want to make my site vulnerable.

Attached Files
special_offers.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I'm a little confused, you applied the filtering to the rsPrice recordset, but you are not using that recordset anywhere on the page?


the only recordset that is used on the page is the rsOffers recordset?

Sign in to reply to this post

A Sound Design

Originally Said By: Jason Byrnes
  I'm a little confused, you applied the filtering to the rsPrice recordset, but you are not using that recordset anywhere on the page?


the only recordset that is used on the page is the rsOffers recordset?  



Well, I created the rsPrice recordset to create the filter for the Search By Price select list that you have been helping me with in this thread. I thougt this would then be displayed by the output of the maxPrice form

<form id="frmPriceRange" name="frmPriceRange" method="post" action="">

<label>maxPrice
<select name="maxPrice" id="maxPrice">
<option value="500">Up to £500</option>
<option value="700">Up to £700</option>
</select>
</label>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</form>

The rsOffers is to simply display all records from the DB.

Please advise me as to what I need to do now to get it working.

Sign in to reply to this post

Jason ByrnesWebAssist

So then it is the rsOffer recordset you want to apply the filtering to.

add the variable to filter by price to the rsOffer recordset.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...