merge 2 input values in url

后端 未结 1 1947
说谎
说谎 2021-01-28 19:31

I have form like this:

Color:
Car:
相关标签:
1条回答
  • 2021-01-28 20:15

    I don't really know of a way to modify the HTML form to produce that query string from two separate inputs. But in the PHP script that handles the form submission, the URL you're trying to get is basically the equivalent of this:

    $_GET['color'] = implode(' ', $_GET);
    unset($_GET['car']);
    

    This will change $_GET to

    array (size=1)
      'color' => string 'red bmw' (length=7)
    

    as if you had submitted to

    http://mywebsite/?color=red+bmw
    
    0 讨论(0)
提交回复
热议问题