Hi all
I have 2 php scripts. page1.php and page 2.php
On page1.php i have 2 variables. $var1 and $var2.
If u submit page1.php i am redirecting the page to page2.php using
header "location:page2.php";
exit();

How can i access the $var1 and $var2 on page2.php
Will it not post the values of the variables to page2.php automatically, so that i can use it.

Thanks
IM

    header("Location: page2.php?var1=$var1&var2=$var2\n");

    No, it will not automatically send variables. You must tell PHP to send them by writting <variable_name>=$<variable_name> after the ? in the URL.

      but, this will show the values of the variable in the url.
      Is there any way i can post these variables to the next page without showing it in the url. I have around 10 variables to pass to next page.

      Thanks

        Originally posted by phpprog
        but, this will show the values of the variable in the url.
        Is there any way i can post these variables to the next page without showing it in the url. I have around 10 variables to pass to next page.

        Thanks

        You could write them to a temporary file, I suppose. Or set them in a cookie, but some folks could read that too. Or learn about sessions... check session_register in the manual....

        dalecosp

          Write a Reply...