Baqer
Baqer

Reputation: 13

How can I implement Advanced Search using HTML?

I have been trying to implement a form that goes to a search of some word in advanced search using Google search, a problem is during I want to implement the code it redirects to the Google search page.

Thank you"

<form action="https://google.com/search">
    <h2>Find Pages with</h2>
    <div class="input-group row">
        <label class="lb" for="fword">all these words:</label>
        <div class="input-lb">
            <input type="text" class="from-ad" name="af-w"><br>
        </div>
    </div>

    <div class="input-group row">
        <label class="lb" for="phword">this exact word or phrase:</label>
        <div class="input-lb">
            <input type="text" class="from-ad" name="ew-p"><br>
        </div>
    </div>

    <div class="input-group row">
        <label class="lb" for="aword">any of these words:</label>
        <div class="input-lb">
            <input type="text" class="from-ad" name="a-w"><br>
        </div>
    </div>

    <div class="input-group row">
        <label class="lb" for="nword">none of these words:</label>
        <div class="input-lb">
            <input type="text" class="from-ad" name="n-w"><br>
        </div>
    </div>

    <div>
        <input type="submit" name="btnA" class="btn" value="Advanced Search" aria-label="Advanced Search">
    </div>
</form>

Upvotes: 1

Views: 605

Answers (1)

Austin
Austin

Reputation: 107

You are using outdated name values inside your form, which is causing your form to improperly submit to Google advanced search. Make sure to replace each of the values with the current ones listed below.

all these words: as_q

this exact word or phrase: as_epq

any of these words: as_oq

none of these words: as_eq

With the values replaced with the new ones, your form should look like this:

<form action="https://google.com/search">
  <h2>Find Pages with</h2>
  <div class="input-group row">
    <label class="lb" for="fword">all these words:</label>
    <div class="input-lb">
      <input type="text" class="from-ad" name="as_q"><br>
    </div>
  </div>

  <div class="input-group row">
    <label class="lb" for="phword">this exact word or phrase:</label>
    <div class="input-lb">
      <input type="text" class="from-ad" name="as_epq"><br>
    </div>
  </div>

  <div class="input-group row">
    <label class="lb" for="aword">any of these words:</label>
    <div class="input-lb">
      <input type="text" class="from-ad" name="as_oq"><br>
    </div>
  </div>

  <div class="input-group row">
    <label class="lb" for="nword">none of these words:</label>
    <div class="input-lb">
      <input type="text" class="from-ad" name="as_eq"><br>
    </div>
  </div>

  <div>
    <input type="submit" name="btnA" class="btn" value="Advanced Search" aria-label="Advanced Search">
  </div>
</form>

Upvotes: 1

Related Questions