Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pass variable to php form after submitting the form

I want to pass the variable from php page to another without using sessions.

here's SearchCustomer.php page which have the from

<form action="controllers/Customer.controller.php" method="post">
<label for="cellPhoneNo">cell phone number</label>
    <input type="text" name="cellPhoneNo" class="textField"/>
    <span id="cellphonePrefix"></span>

    <label for="telephone">telephone </label>
    <input type="text" name="telephone" class="textField"/>

    <input type="submit" name="searchCustomer" value="بحث"/>

in Customer.controller.php I search for customer and return a $result, I want to pass the variables defined in Customer.controller.php to SearchCustomer.php page which the from is submitted from without using sessions.

like image 927
palAlaa Avatar asked Feb 24 '26 06:02

palAlaa


1 Answers

You can achieve this with hidden input controls.

In Customer.controller.php:

echo "<input type='hidden' name='result' value='{$result}'>";

In SearchCustomer.php:

$passedResult = $_POST['result'];

Update: Question did change a bit, use a redirect similar to this:

header("Location: http://yoursite.com/SearchCustomer.php?result={$result}");
like image 172
JK. Avatar answered Feb 25 '26 19:02

JK.