How to send data like html tag a but through a form? You must pass the value of the variable page=1

 <a href="www.nostname/web/index.php?r=test/access/index&page=1"> 

I'm trying to:

 `<form action="www.nostname/web/index.php?r=test/access/index&page=1" method="get"> Поиск: <input type="text" name="page"> <p><input type="submit"></p> </form>` 

But instead of going to this address:

http://nostname/web/index.php?r=test/access/index&page=1

goes over this if I enter forms 3 imput.

http://nostname/web/index.php?page=3

  • Well, the form has an action attribute, you pass the link <form method="www.nostname/web/index.php?r=test/access/index&page=1">.. , and when the form is submitted, the form will follow this link to the server. - Vasily Barbashev
  • @ Vasily Barbashev It is not. Now I will show where she turns. - gilo1212
  • @ Vasily Barbashev I updated my question. - gilo1212

1 answer 1

With an updated question, the solution is:

 <form action="www.nostname/web/index.php" method="get"> Поиск: <input type="text" name="page"> <input type="hidden" name="r" value="test/access/index"> <p><input type="submit"></p> </form> 

As a result, follow the link:

 www.nostname/web/index.php?page=5&r=test%2Faccess%2Findex 

On server: $_GET

 Array ( [page] => 5 [r] => test/access/index ) 
  • Does not work . you have the value of the page in front of you need at the very end what would have happened. example - www.nostname/web/index.php?r=test/access/index&page=1 - gilo1212
  • uh, change the elements in places then, just put the hidden field above. Not really hard to guess? - Vasily Barbashev
  • I did it but it does not work. Because the value is encoded there because of the wrong address - gilo1212
  • what is encoded? understood nothing. There is nothing can be encoded. I wrote to you that the server returns to $_GET . There is nothing encoded - Vasily Barbashev
  • Uraaa ... Earned ... Yes, everything is correct .. Thank you, I love you !!!! - gilo1212