I have a form on page1.php.
The form action is "page1.php".
After some sanitation and validation takes place and there are no errors, when a user clicks the submit button, I need the page be redirected and a variable passed to the destination page.
The redirection is done with this code:

if (!$errors) {
         header(
              "location: offerform_switch.php");
}

The variable ($invtype) doesn't get passed.
How do I get it passed?
Or perhaps using HEADER to get to the other page is not a good idea in the first place?
What then would be a good idea?

Thank you!

u can pass values from one to another page by storing it in SESSION.

header is use to redirect the page.

and if you really want to pass values through header only then u have genrate url.

header('location:destination.php?value1=1&value2=3');

but it is not a good method...

just store values in SESSION after form submit.

Thank you!
I'm going to give it a try.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.