Skip to content Skip to sidebar Skip to footer

Html Form Method With Nice Url

I just want to know whether there is a way to answer this question with 'Yes' without using JavaScript. What I want to do is have a search form that automatically generates URLs li

Solution 1:

No, it's not possible without using JavaScript.

The best you can do is using a GET action and have an url like http://example.com/search/?q=my+search+term, where q is the name of the input search box.

Solution 2:

Using html only, no.

You could have something server side that might work. You could have the server respond with a 302 response code. If you are using Apache, you could probably use mod_rewrite to take the GET request and generate a new url.

For example, the browser might ask for http://example.com/search/?q=blah+foo+bar, the server could then take that and send the browser a 302 redirect for http://example.com/search/blah+foo+bar.

See more information at the Apache url rewriting guide, or by using your favorite search engine.

You could still use javascript to generate the correct url, but if someone has javascript disabled, this would work as a fallback.

Solution 3:

The answer is No

Solution 4:

No if you want it to be client side, if you can do it server side (by submitting the form) you can use something like PHP

Solution 5:

Yes you could perform something like this server-side pretty easily as long as you don't mind submitting a form.

EDIT: Upon further clarification from the author in comments below: It is not possible in a pure client-side manner without JavaScript or some other client-side tool like Flash/Silverlight (which is admittedly overkill).

Post a Comment for "Html Form Method With Nice Url"