Skip to content
Advertisement

How to pass variable using post method?

There are a page page1.php below:-

JavaScript

after submitting the form at page1, How to get value of $name of page1.php in page2.php what should change in page-1?

Advertisement

Answer

If you ask also for a name on page1, then simply use another input:

JavaScript

If the name is fixed and you want it transmitted via POST, usa a hidden input:

JavaScript

Then in page2.php read the POST-ed value:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement