Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

(Adaptive) forms for quick quote?

Featured Replies

Hi all, first post (hello) and it's more than likely a very simple one for php knowledgeable folk. I don't know any php at all, just html!

 

What I'm trying/wanting to do is a create a php form with dropdowns that the website visitor submits.

 

However, the thing I need to do is change the price range based on a certain dropdown selection.

 

So for example:

 

First dropdown > option 1 or option 2

 

If option 1

 

The second dropdown displays price ranges> 100/200/300/500

 

Or if option 2 is selected in first dropdown display price ranges > 500/1000/1500

 

Does that make sense?

 

Any guidance would be much appreciated!

  • Author

If it helps it's for a local tradesman (doing him a simple 5 page site) who does carpentry and wants to offer bespoke furniture on his website, only a quote system and not ecommerce.

 

What he doesn't want is for people to select table and see the minimum budget of £100 when it's more like £400+.

 

So when they select chair they get £100 up and when they select table it changes to £500 and up.

As a rough guide:

 

Your drop downs need to be in a form which sends the results to a php file (could be the same one, could be a different one, doesn't really matter).

 

Then the php retrieves the data from the form using $_POST['price'], $_POST['item_type'] etc.

 

Then the php constructs an SQL query:

$query = "SELECT * from {$_POST['item_type']} WHERE price <= {'$_POST['price']}'";

 

Then you display the results from the query. If you're happy creating forms in HTML then your next step is setting up a basic database and learning how to connect to it with php.

 

To have the budget range change you need to do a similar thing:

 

When the item type is changed auto submit the form (javascript is the easy way to do this), then do a query to find the most and least expensive options in that type, then construct your <select><option> price rance based on that (eg round the lowest down to the nearest 100, round the highest up to the nearest 100, and loop through between the two values in increments of 50 or whatever suits you).

Edited by T-G

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.