LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-02-2010, 12:53 AM   #1
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 935

Rep: Reputation: 32
Search with list/menu


Hi all

I would like to be able to search 3 sites by entering what you want to search for then click a site from the menu/list and click search

I've created the form OK, here's the problem, I can't seem to find a tutorial that shows me how to add in the urls to point to each site after you did a search

any ideas please.

here's what I've done http://linux.rockinghamgateway.com/t...rch/index.html

Code:
<form method="get"> 
<table border="0" width="260">
<tbody>
<tr style="text-align: left;">
  <th width="204" scope="col"><input id="query" name="query" size="22" type="text" /></th>
<th width="46" rowspan="2" scope="col"><img src="System-Internet-Search-icon.png" alt="Search Site" width="32" height="32" border="0" align="middle" /></th>
</tr>
<tr>

  <td><label>
    <select name="select">
      <option value="1">Gallery Images</option>
      <option value="2">Forums Topics</option>
      <option value="3">Search Sphider</option>
    </select>
  </label>

    <input name="submit" type="submit" value="Search" /></td>
</tr>
</tbody>
</table>
</form>
 
Old 04-02-2010, 08:25 AM   #2
audiodude
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Rep: Reputation: 0
Arrow Use javascript

So you want it so that when the form submits, it searches the site you selected right?

Basically you want to ditch the submit button and put a
Code:
<button onclick="submitSearch()">Submit</button>
Then in the submitSearch function, you look at the value of the select and swap in the proper:
Code:
function submitSearch() {
  var theForm = document.getElementById('searchForm');
  var whichSite = document.getElementsByName('select')[0].value;
  if(whichSite == 1) {
    theForm.action = 'http://gallery-images.com/search/thisurlisfake'
  } else if(whichSite == 2) {
    ...
  }

  theForm.submit()
Remember to add id="searchForm" to the form tag at the top of your code.
 
  


Reply

Tags
forms, html


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
search mailing list archive lordofring Linux - Software 3 03-12-2006 10:56 AM
Looking for a mailing list search engine koyi Linux - Software 1 10-24-2005 03:07 PM
How can I add search to the K menu? SolidSnakeX28 Linux - Software 2 09-17-2005 09:36 PM
How can I search a mailing list? bolinux General 3 11-08-2003 10:27 PM
List controls for search items... Thymox LQ Suggestions & Feedback 2 05-21-2002 08:16 AM


All times are GMT -5. The time now is 03:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration