Passing variable from one PHP file to another PHP file
In this example, we are trying to pass variable from one page to another page using php. Here we are creating two php file for running this example. The example below display a simple php form with two input fields and submit button.
For passing variable from one page to another page , we are using POST method in this example. Let's see the example.
Output :
For passing variable from one page to another page , we are using POST method in this example. Let's see the example.
File Name : demo.php
- When You want to sending form data from one page to another page , this time POST method is used.
1 2 3 4 5 6 7 8 9 10 11 12 | <!DOCTYPE HTML> <html> <body> <form action="welcome.php" method="post"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> <input type="submit"> </form> </body> </html> |
File Name : welcome.php
1 2 3 4 5 6 7 | <?php $name=$_POST["name"]; $email=$_POST["email"]; echo "Welcome ".$name; echo "<br/>"; echo "Your Email Id is : ".$email; ?> |
Output :
How to pass value in another page in Php, Passing variable from one page to another page, Passing variable from one Php file to another Php File, Php Tutorial, POST method example in Php
0 comments:
Post a Comment