Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

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

<form method="get"> 
<table border="0" width="260">
<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>

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

    <input name="submit" type="submit" value="Search" /></td>
Old 04-02-2010, 08:25 AM   #2
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
<button onclick="submitSearch()">Submit</button>
Then in the submitSearch function, you look at the value of the select and swap in the proper:
function submitSearch() {
  var theForm = document.getElementById('searchForm');
  var whichSite = document.getElementsByName('select')[0].value;
  if(whichSite == 1) {
    theForm.action = ''
  } else if(whichSite == 2) {

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


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 > Forums > Non-*NIX Forums > Programming

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

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