G
G
Genri_Rus2019-02-05 16:08:41
PHP
Genri_Rus, 2019-02-05 16:08:41

How to do dynamic CNC search?

Good afternoon and, as usual, good mood.
There are some ideas in adding CNC search.
Here is the form itself:

<form class="my-class" role="search" action="http://example.ru/search/" method="post">
        <input type="text" name="str" placeholder="Поиск" value="">
  <button type="submit">Поиск</button>
        </form>

The question arose as follows, how to pass search data to a string?
For example, in the GET line, the name=str parameter, and POST is responsible for finding articles and displaying them on the page
But only that the query string should contain something like this example.ru/search - /here, what the user was looking for
Tried to implement this through .htaccess
RewriteEngine On RewriteRule ^search/([ a
-zA-Z0-9]+)?$ search.php?str= $ 1 what the user was looking for

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FeST1Val, 2019-02-05
@FeST1Val

Well, everything seems to be correct, isn't it? you just don't go to the page or what? in the script, just make a transition when you click on the search button
PS I would probably do this RewriteRule ^search/(.*)/$ search.php?str=$1 [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question