I am new to php and need to understand how post get method could be useful for my code. My scenario is, I have 3 webpages, 1st webpage is an html form , I am using post method here then I take firstname and last name from form and enter in a sql query(for e.g. $_POST[firstname]) on 2nd webpage which generates some data for me and I am printing that data.
Now I need to pass same parameters to 3rd page which generates some graph based on firstname and lastname entered in 1st HTML form?
How can I persist these values on 3rd php page? I am referencing url for page 3 on page and I believe that is not sufficient, I tried Google search and found out post get could be useful however need some expert advice.
Thanks
You can use something like this:
1st page (page1.php)
2nd (page2.php)
Retrieve and validate
$_POST['firstname']and$_POST['lastname'], then create an output with your required data, you can use hidden fields or create links, according your needs. For instance:3rd page (page3.php)
If you use the solution with a link or with a form with GET method, you can retrieve the data in
page3.phpjust doing the following:Hope it can help you!