11175
(-- --)
1
I have a search form on page. It works fine, but if user give a search
word by typing it in URL:
http://domain.com/search/?word=searchword
After that search form dosn't work any more, because form post data to
this URL and word in URL overwrite input-word in form.
What can I do to fix this?
In PHP a simple can:
if $_POST['word']
$word = $_POST['word']
else
$word = $_GET['word']
end
But what I can do in Rails?
Con
(Con)
3
Hi, where’s the relevant Rails source so that people can better assist you? Also, what version of Rails are you using?
-Conrad
11175
(-- --)
4
Rails is 2.1
The problem is that if "page" gets parameters from form (POST) and from
URL (GET),
so GET parameter overwrtie POST.
Well one solution would be to use different names, Then u could do
@word = params[:word] || params[:word_post]