<form action="?route=category/create" method="GET"> <input type="text" value="" name="cname" size="60" placeholder="Название категории" maxlength="255"> <input type="text" value="" name="sub_cname" size="60" placeholder="Выбирете подкатегорию" maxlength="255"> <input class="btn btn_default" type="submit" value="Создать"> </form> 

The initial page address for creating a category is: .../index.php?route=category/add

after filling in the input fields and clicking on the submit button in the address bar, the address is: .../index.php?cname=test&sub_cname= <- it turns out that I pass the parameters to index.php and I need to transfer to index.php?router=category/

I need / want the address to be such test.my/admin/index.php?route=category/create&cname=test&sub_cname=

That is, after clicking on the form button ?route=category/create is removed from the address bar

explain how to implement it

Archive unpack to the root of the site. The yousitename.ru/admin/index.php?route=category/add will be such yousitename.ru/admin/index.php?route=category/add

Just in case, attach the archive with the code

    1 answer 1

    Add a hidden field with the value set:

     <form method="get"> <input type="hidden" name="route" value="category/create"> <input type="text" value="" name="cname" size="60" placeholder="Название категории" maxlength="255"> <input type="text" value="" name="sub_cname" size="60" placeholder="Выбирете подкатегорию" maxlength="255"> <input class="btn btn_default" type="submit" value="Создать"> </form> 
    • added <input type = "hidden" name = "route" value = "category / create"> now URL:? route = category% 2Fcreate & cname = test & sub_cname = where% 2F characters came from But now I wondered what I would have to do with each form , and this is something wrong and stupid. Maybe tell me what to change? - Astend Sanferion
    • one
      %2F is the same / , but in accordance with the standard for the formation of the url ru.wikipedia.org/wiki/…. On the server side, there is usually automatic character decoding. If for some reason it is not there, then in programming languages ​​there are functions for this - Visman