开发者

URL not changing after submitting a form

I have a form which looks like this:

<form action="" method="post">
...
</form>

When I click submit in it, I expect it to refresh 开发者_Python百科the URL with the values submitted in the form. But it doesn't. The problem is that the submission depends on the url parameters.

Here is the problematic page:

http://www.comehike.com/hikes/search_hikes.php?all=yes&when=f&redirect=yes

If you search the top-left form it will not actually search what you asked because the URL isn't changing. It just searches the default values. Is there any way to remedy this? Where am I going wrong?

Thanks!


The action contains a relative URI pointing to the current URI and the method says to post the data (so it wouldn't appear in the query string). So you are getting the expected behaviour.

It sounds like what you want is actually:

<form action="search_hikes.php" method="get">


Shouldn't your post be a get if you want it to send the form values via the querystring?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜