gpt4 book ai didi

javascript - 如何使 php 提交按钮跟随带参数的 URL 与 Echo(当前设置)?

转载 作者:行者123 更新时间:2023-12-02 17:14:57 25 4
gpt4 key购买 nike

我的代码:

<?php if(isset($_POST['submit'])){
$drop = $_POST['drop_1'];
$drop_2 = $_POST['drop_2'];
$drop_3 = $_POST['drop_3'];
echo "<Table style='background:#ccc; width:800px; font-family:Open Sans;height:60px;'> <tr><Td width='500px'>

You selected $drop $drop_2 $drop_3</td><td>
<a target='_parent' href='http://www.xxxxxx.com/index.php/catalogsearch/advanced/result/?name=&description=&short_description=&sku=&price%5Bfrom%5D=&price%5Bto%5D=&make=$drop&v_model=$drop_2&&engine=$drop_3&&category=3'>See XXX For Your XXX</a></tr></table>";
//echo $drop_3." ".$drop." ".$drop_2;

} ?>

我的目的不是显示包含变量的表格,而是让它跟随链接

www.xxxxxx.com/index.php/catalogsearch/advanced/result/?name=&description=&short_description=&sku=&price%5Bfrom%5D=&price%5Bto%5D=&make=$drop&v_model=$drop_2&&engine=$drop_3&&category=3 

点击提交按钮后。

我试过了

if($_POST['submit'] == 1 )
header("Location: http://www.xxxxxxxxxx.com");

但是,它并没有起作用,页面只是重新加载。

请指教,谢谢!

最佳答案

您可以通过两种方式执行此操作,或者更改代码以便:

<?php 
if(isset($_POST['submit']))
{
$drop = $_POST['drop_1'];
$drop_2 = $_POST['drop_2'];
$drop_3 = $_POST['drop_3'];

header('Location: http://www.xxxxxx.com/index.php/catalogsearch/advanced/result/?make=$drop&v_model=$drop_2&engine=$drop_3');

}
?>

但是,最好的办法是更改您的表单,以便操作是您要发布到的 URL,例如http://www.xxxxxx.com/index.php/catalogsearch/advanced/result/并将方法更改为“GET”,然后适本地命名表单字段(make、v_model 和 engine)。

关于javascript - 如何使 php 提交按钮跟随带参数的 URL 与 Echo(当前设置)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24517757/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com