G
G
ghst_ltnnt2014-06-19 02:30:31
PHP
ghst_ltnnt, 2014-06-19 02:30:31

How to make redirect form action="/test/" on test.php?

Good day.
Please tell me how to implement the following functionality.
There is html code

<form action="/test/" class="test">
<input class="inputs" type="text" placeholder="поиск" name="testword" method="$_GET">
</form>

After pressing the Enter button, you go to the address " testsite.ru/test?testword= "
How to make a redirect to "test.php" with the transfer of the "testword" parameter?
Perhaps something needs to be written in .htaccess?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
Dmitry Pyatkov, 2014-06-19
@ghst_ltnnt

RewriteRule ^/test/ /test.php?%{QUERY_STRING} [L]

K
Konstantin Velichko, 2014-06-19
@Zoxon

<form action="test.php" method="get" class="test">
  <input type="text" class="inputs" placeholder="поиск" name="testword" />
</form>

A
Andrey Golumenov, 2014-06-19
@Golumenov

habrahabr.ru/post/31054
Everything is in the comments

G
ghst_ltnnt, 2014-06-19
@ghst_ltnnt

I read this post, but it didn't work.
There is an entry in the log:
File does not exist: .../www/test, referer : testsite.ru
RewriteRule ^/test/ /test.php?%{QUERY_STRING} [L] doesn't work.

K
Kevinus, 2014-06-20
@Kevinus

<form action="test.php" method="POST" class="test">
  <input type="text" class="inputs" placeholder="поиск" name="testword" />
</form>

only then do not forget that to catch this form either in $_REQUEST or $_POST

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question