dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Changing the HTML page depending on dropdown selection

  1. #1
    Join Date
    Feb 2016
    Posts
    9

    Changing the HTML page depending on dropdown selection

    Hi all.

    I am struggling to find the correct post to help me.

    I have a simple search feature on my website, two dropdowns (Category and Location) and the search button.
    I want to have the City dropdown required.

    Here is a breakdown;
    HTML Code:
    <select class="form-control" title="" id="category">
        <option value="">All</option>
        <option value="-bed-breakfast">Bed &amp; Breakfast</option>
        <option value="-self-catering">Self-Catering Guesthouse</option>
        <option value="-backpackers">Backpackers</option>
        <option value="-hotel">Hotel</option>
    </select>
    HTML Code:
    <select class="form-control" title="Location" id="location" required>
        <option value="-city1">City 1 Name</option>
        <option value="-city2">City 2 Name</option>
        <option value="-city3">City 3 Name</option>
        <option value="-city4">City 4 Name</option>
    </select>
    When the Search / Submit button is clicked, I need the form to perform an action along the lines of merging the two options selected.
    There needs to be a preloaded "accommodation" already, so for example, if the user selects (Hotel) and (City 1 Name), the button needs to send the user to the following page: accommodation-hotel-city1.html

    The Category selection can also be left blank/unselected, but the Location needs to be required, so a result can be: accommodation-city1.html

    Is there a simple way of getting this done?

    Thanks.

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,830
    Hi there Kaldera,

    this needs to be done server side.

    Check out the attachment, which includes a simple PHP example.

    coothead
    Attached Files Attached Files
    ~ the original bald headed old fart ~

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles