SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple url's in a search "<form action..." statement.

    I have this search bar on my site that begins with:
    PHP Code:
    <form id="searchform" class="non-widget" action="http://www.mysite.com/" method="get"
    This is going to sound silly, but how do I replace the url in the action statment with multiple urls of my choice?

    Thanks
    Any help is realy appreciated.

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any idea?

  3. #3
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest you aim the form at a script file and have that take care of querying your multiple urls. There's an example here.
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe I need to tell you more about what I am trying to do.
    I have kind of library site with all kind works published in it and, like mine, there are some other sites of the same kind.
    I need to use an 'action' that will go searching my site and then the other sites (of my choise) for the same key word.
    I was thinking of something like comma separated site names.

  5. #5
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    925
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    A form cannot have multiple urls as action. And how do you imagine your idea of action "searching your site and other sites" to work? When you submit a form to a url then the browser is redirected to this url and the action results (search results) are displayed at this url. Redirecting to multiple urls doesn't make sense since a single browser window can open only 1 url. You need to tell us more how you imagine this to work. Multiple iframes? Multiple windows? Single page with results from all searches?

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Single page with results from all searches. Something to Google search by only on specific sites

  7. #7
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    925
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Then I don't think there is any other way than what 2ndmouse said above. Submit the form to a php script and have the script load the search results from the other sites (for example using curl) and combine them into a single html page. This may or may not be easy depending on how the result pages are structured, how different they are and most probably this will require some html parsing.

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much for you tips. I will have to start digging into what 2ndmouse said(thank him too).

    Off topic: My wife is Polish.

  9. #9
    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)
    Doable with JS, but that can be turned off.

    http://www.tek-tips.com/viewthread.cfm?qid=1235640

    Each of your target sites might require different q= variables though ...

  10. #10
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    925
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by esn003 View Post
    Thank you so much for you tips. I will have to start digging into what 2ndmouse said(thank him too).
    Compiling search results from multiple pages can take a long time but it can work well for 2 or 3 sites...

    Off Topic:

    Quote Originally Posted by esn003 View Post
    Off topic: My wife is Polish.
    Polish women are pretty


    Quote Originally Posted by Cups View Post
    Doable with JS, but that can be turned off.

    http://www.tek-tips.com/viewthread.cfm?qid=1235640

    Each of your target sites might require different q= variables though ...
    But it looks like the OP wants to display all results on one page and not change the form action dynamically. But with a little bit of javascript (+ajax) it would be possible to query each site for results and display them on a single page. It would be a little harder to do than in php but potentially it would work faster because the browser could contact all sites concurrently while php would have to contact them one at a time, and also there wouldn't be the need to contact the php script's server.


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
  •