Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 根据数据库数据将用户重定向到web地址_Php_Url_Redirect - Fatal编程技术网

Php 根据数据库数据将用户重定向到web地址

Php 根据数据库数据将用户重定向到web地址,php,url,redirect,Php,Url,Redirect,我在我的add-vehicle.php中使用以下代码在提交表单后重定向我的用户,它可以正常工作..(这不是全部代码) 但我想将我的用户重定向到一个独特的webadres。例如: www.mysite.com/add vehicle?succes/car_id=1和www.mysite.com/add vehicle?succes/car_id=2'的下一个 所以我想在我的url中输出数据库的数据。。 最好的方法是什么?您可以使用PHP变量来调整URL header('Location: http

我在我的add-vehicle.php中使用以下代码在提交表单后重定向我的用户,它可以正常工作..(这不是全部代码)

但我想将我的用户重定向到一个独特的webadres。例如:

www.mysite.com/add vehicle?succes/car_id=1
www.mysite.com/add vehicle?succes/car_id=2'的下一个

所以我想在我的url中输出数据库的数据。。
最好的方法是什么?

您可以使用
PHP
变量来调整URL

header('Location: http://' . $_DBPage);

查询数据库中的信息,并将其附加到位置字符串。从数据库中获取数据,将其绑定到变量并将其放入url字符串中。感谢您的评论!
header('Location: http://' . $_DBPage);