SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    html forms - checkbox - how to add string to search?

    I have a html form that searches an online store, right now I'm using radio buttons to search for items 10-30% off. Now I'm wanting to add a checkbox to also search for items that offer free shipping. How do I add a checkbox to the form which will add to the existing % off string?

    Thanks in advance.

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I keep playing with the code and I don't think it's going to be possible.

    Such as adding the following checkbox:
    Code:
    <input type="checkbox" value="ship0-" name="search" id="shipping">
    Then performing a search for Xbox that's 10% off and free shipping results in the following string:

    Code:
    http://domain.com/s/term=Xbox&search=10off&search=ship0
    The Red and Blue lines need to be merged in order for it to work, like:

    Code:
    http://domain.com/s/term=Xbox&search=10offship0

  3. #3
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,095
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    I realise I'm very late, but what you're asking is not possible in HTML only. You'd need either some Javascript on the client side, or some server side processing (which would be preferred over client side).
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  4. #4
    SitePoint Member
    Join Date
    Jun 2012
    Location
    Orange County California
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is your api call. The "&" separates each variable / value pair. You can't smash them all together like that. I'm assuming your using your querying a third party api and not querying your own database?


Bookmarks

Posting Permissions

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