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 8074183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:34:16+00:00 2026-06-05T14:34:16+00:00

On my site, I can access a search function by going to mysite.com/search/search_term, where

  • 0

On my site, I can access a search function by going to “mysite.com/search/search_term”, where “search_term” is the term the user entered. I’m trying to get a simple one-input form to format the URL that way. One way that I can do it is make a PHP script that would redirect to the proper place. So if you navigate to “search_redirect.php?term=search_term”, it would just redirect you to “/search/search_term”. I want to avoid doing this, as it seems kind of redundant. If I don’t find a better answer, that’s probably what I’ll end up doing. Now, here’s what I tried so far:

I tried setting an onsubmit on the form like this:

<form onsubmit="search_navigate()" id="navbar_form">
    <input type="search" placeholder="Search Articles..." id="navbar_search"></input>
    <input id="navbar_submit" type="submit" value=">"/>
</form>

… which, onsubmit calls this function:

function search_navigate(){
    alert("well hey there");
    window.location = ("http://www.google.com");
}

When I click on the submit button, I can see the alert, but instead of taking me to Google as you’d expect, it takes me to the same page I’m on (whatever that page might be).

This is the problem I’m faced with when implementing it this way. If you have another way entirely, I’d still like to hear it.

  • 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-05T14:34:18+00:00Added an answer on June 5, 2026 at 2:34 pm
    function search_navigate() {
        var obj = document.getElementById("navbar_search");
        var keyword = obj.value;
        var dst = "http://yoursite.com/search/" + keyword;
        window.location = dst;
    }
    

    may this work for you?


    further more, to stop the form submit doing its origin function, append “return false” to the function call, that is, onsubmit=”foo();return false”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In config/routes.php <?php return array( 'account/profile/change_password' => 'users/account/change_password', ); I can access site.com/users/account/change_password and
I have a site that can be accessed both through http (http://mysite.com) and https
For example to get the favicon of a site I can use http://www.google.com/s2/favicons?domain= and
I'm trying to fix a bug with a site search function and have isolated
i created a site on my iis7 it's like http://localhost:88/my i also can access
I can't access java decompiler site: http://java.decompiler.free.fr/?q=jdeclipse . It shows 403 error : Erreur
I have a site that can allow me to access the mobile version of
I'm working on a site that can be displayed to the user in several
I'm trying to get access to a Javascript API, I created, on other sites.
I am building a multi-user web application. Each user can have their own site

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.