Let's all be examples.
I am redirecting from A.php to B.php with a parameter, let's say it ID=1.


And I wanna hold the value of the ID.
Whenever I press a button on B.php, the value ID=1 gone.

Any idea of how can I hold that value ?
Thanks for in advance.

Whenever I press a button on B.php, the value ID=1 gone.

Can you clarify this? Right now it seems the issue is not related to A.php but just to what happens inside B.php.

When page load of B.php, I store the value of the URL.

$id = $_GET['cust_no'];

Then whenever I pressed a button on B.php, the value $id become null.

I would like to keep the value of $id after B.php is submit.

I already try using Session to retrieve the value.
But the value of session still null.


    function runProrgam() {
        $_SESSION["custno"] = $_GET["cno"];
        ECHO ("<script type='text/javascript'>");
        ECHO ("document.location.href = 'B.php'");
        ECHO ("</script>");



        function runProrgam() {
             $custno = $_SESSION["custno"];

             ECHO ("This is Session Value " .$custno);

Please also note that my session_start() very top of every pages before HTML and php code

<?php session_start(); ?>

Hmm, the session in this case it is not, probably, the best approach: what happens if, in the current session, you open multiple tabs of A.php with different IDs?


It would screw up, because the session value would be rewritten by the latest loaded tab. Append the query string to B.php, so if you are using a form you can do:

<form method="get" action="B.php?id=123">

Or hide it in the input fields:

<input type="hidden" name="id" value="123">

If you want more appropriated help, share an example of what you are trying to do.

commented: Good shout about multiple tabs +1 - a common gotcha! +0

Thanks for your help.
Now I am enable to execute my program correctly with applied hidden field.
So when 2nd page load, I'll store the URL value into hidden value.

<input type="hidden" name="cno" value="<?php ECHO ($_GET["custno"]); ?>" />

Then whenever a button pressed on 2nd page, I am able to retrieve the value of it.

ECHO ($_GET["cno"]);

Thanks for your help buddy.