Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:46:02+00:00 2026-06-12T07:46:02+00:00

Here is the code for a small program where you put the keyword, choosing

  • 0

Here is the code for a small program where you put the keyword, choosing the search engine and then pressing “Search” button to search. But google don’t leave me to POST. What else I can do?

EDIT: Yahoo and Bing works fine.

ERROR

405. That’s an error.

The request method POST is inappropriate for the URL 
/search?q=computer. That’s all we know. 

HTML

<form name="search" action="" method="Post" onSubmit="redirect()">
<input type="text" name="keyword"><br />
Google<input type="radio" name="ch" checked>
Yahoo!<input type="radio" name="ch">
Bing<input type="radio" name="ch"><br />
<input type="submit" value="Search">
</form>

Javascript

<script type="text/javascript">
var searchengine=[
"http://google.com/search?q=",
"http://search.yahoo.com/search?p=",
"http://bing.com/search?q="
];

function redirect()
{
    var radioButtons = document.getElementsByName("ch");
    for (var x = 0; x < radioButtons.length; x++) {
        if (radioButtons[x].checked)
        {
            document.search.action = searchengine[x] + document.search.keyword.value;
        }
    }
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:46:03+00:00Added an answer on June 12, 2026 at 7:46 am

    But google don’t leave me to POST. What else I can do?

    Use GET rather than POST in your form, or just assign the relevant URL to window.location.

    Here’s an example of the latter. Some other changes:

    • Added some labels.
    • Changed how you’re matching up the selected radio button and the searchengine to make it more robust/maintainable.
    • Changed the name of the search form. Since this gets dumped on the window object I avoid simple words like “search”.
    • Properly encoded the keyword (you must encode URI parameters).

    Live copy | Live source

    HTML:

    <form name="searchForm" action="" method="GET" onSubmit="return doSearch()">
    <input type="text" name="keyword">
      <br>
      <label>Google<input type="radio" name="ch" value="google" checked></label>
      <label>Yahoo!<input type="radio" name="ch" value="yahoo"></label>
      <label>Bing<input type="radio" name="ch" value="bing"></label>
      <br>
      <input type="submit" value="Search">
    </form>
    

    JavaScript:

    var searchengine = {
      "google": "http://google.com/search?q=",
      "yahoo": "http://search.yahoo.com/search?p=",
      "bing": "http://bing.com/search?q="
    };
    function doSearch() {
      var frm, index, cb;
    
      frm = document.searchForm;
      if (frm && frm.ch) {
        if (frm.ch) {
          for (index = 0; index < frm.ch.length; ++index) {
            cb = frm.ch[index];
            if (cb.checked) {
              window.location = searchengine[cb.value] +
                encodeURIComponent(frm.keyword.value);
            }
          }
        }
      }
    
      return false; // Cancels form submission
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my code, I know there's a small mistake somewhere but being a noob
here is a small peice off code that i wrote. But I am not
I've written a small program but the answer it gives is always wrong, here
Possible Duplicate: getting segmentation fault in a small c program Here's my code: char
I have a small code snippet for deleting element in linked list. Here is
Here a small piece of code for testing and explain the problem. I have
Here is code from MSDN . I don't understand why the work isn't just
This is a pretty small program, so I just used the autogenerated code for
I have written a small code, but found something amazing. I have a class
I have a small program I am working on. I Just put a try

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.