PHP,给定两个输入,建立一个链接

时间:2016-09-01 03:23:51

标签: php

我想创建一个包含2个输入的页面。用户在输入中输入“John”和“Smith”,然后单击“提交”。

我希望提交的行为类似于http://www.example.com/Smith/John

的链接

这可能吗?

1 个答案:

答案 0 :(得分:2)

在最基本的层面上,您可以使用header()函数和表单提交中的get / post变量,如下所示:

header('Location: http://www.example.com/'.$_POST["input1"].'/'.$_POST["input2"]);

这会在提交时将用户重定向到http://www.example.com/Smith/John