提交表单后将变量传递给php表单

pal*_*laa 3 php forms variables

我想将变量从 php 页面传递到另一个页面而不使用会话。

\n\n

这里是 SearchCustomer.php 页面,其中包含来自

\n\n
<form action="controllers/Customer.controller.php" method="post">\n<label for="cellPhoneNo">cell phone number</label>\n    <input type="text" name="cellPhoneNo" class="textField"/>\n    <span id="cellphonePrefix"></span>\n\n    <label for="telephone">telephone </label>\n    <input type="text" name="telephone" class="textField"/>\n\n    <input type="submit" name="searchCustomer" value="\xd8\xa8\xd8\xad\xd8\xab"/>\n
Run Code Online (Sandbox Code Playgroud)\n\n

\n\n

在 Customer.controller.php 中,我搜索 customer 并返回 a $result,我想将 Customer.controller.php 中定义的变量传递到 SearchCustomer.php 页面,该页面是在不使用会话的情况下提交的。

\n

JK.*_*JK. 5

您可以通过隐藏的输入控件来实现此目的。

在 Customer.controller.php 中:

echo "<input type='hidden' name='result' value='{$result}'>";
Run Code Online (Sandbox Code Playgroud)

在 SearchCustomer.php 中:

$passedResult = $_POST['result'];
Run Code Online (Sandbox Code Playgroud)

更新:问题确实发生了一些变化,使用与此类似的重定向:

header("Location: http://yoursite.com/SearchCustomer.php?result={$result}");
Run Code Online (Sandbox Code Playgroud)