SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Build a simple form to search another site's information...

    Okay,

    I want to create a search form on my site which uses the same fields and options as that of another site' form from which displays the following in its url when you do a search

    Code:
    search.htm?Service=Disability&keyword=Keyword+Search&Council=All&Search=SUBMIT
    Could I re-create the form on my site that would search the site above using php or possbily use a client side option like jqery's serialize function? http://api.jquery.com/serialize/

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    That depends if you are:

    Just preparing the query string to be sent, and are then relocating the user to CouncilB's website to see the results

    OR

    Preparing the query, searching CouncilB's website but showing the results on your own site (after some scraping/re-formatting)

    OR

    Simply copying the query parameters to be used on your own website and your own search in which case your form simply uses the GET method.
    Code:
    <form action="search.htm" method="GET">
    <select name="Service">
    <option value="Disability">Disability</option>
    <option value="Parking">Parking</option>
    </select>
    <input type="submit">
    </form>
    The resulting URL is

    search.htm?Service=Disability

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for this - i'm more looking to redirect the user to thier site so they can continue searching (the first option).

    The full url when seraching on thier site is- http://www.familysupportni.gov.uk/se...&Search=SUBMIT

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay have this done using the GET method - many thanks!

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Good on you. So you changed the form action to the equivalent of "http://www.CouncilBWebsite.gov/search.htm" ?

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep
    Code:
    <form name="orgSearch" action="http://www.familysupportni.gov.uk/search.htm" method="get" target="_blank" onsubmit="return validate_form()">
                        
                        <select name="Service" id="service">
                            <option>Choose a Service</option>.......
    .


    thanks for making me think about this more logically - i'd like to add a simple clear/reset on the select fields after submiting - are there any snippits out there that could be easily added?


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
  •