How to keep already-set GET parameter values on form submission?

后端 未结 7 844
广开言路
广开言路 2020-12-17 08:10

I have a URL : foo.php?name=adam&lName=scott, and in foo.php I have a form which gives me values of rectangleLength & re

相关标签:
7条回答
  • 2020-12-17 08:45

    Once, I needed sorting the results in a table keeping the search results coming from GET. I did like that:

    unset($_GET['sort']); // sort param is removed, otherwise there will be created many sort params
    $url = http_build_query($_GET);
    
    echo "<a href='?".$url."&sort=title'>Title</a>";
    echo "<a href='?".$url."&sort=author'>Author</a>";
    
    0 讨论(0)
提交回复
热议问题