In this article will teach you how to pass a value from pages to pages in PHP using $_POST command. The code is very basic and intended for those people that are new in PHP programming in general.
If you have some questions please send me an email at jake.r.pomperada@gmail.comand jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
index.php
<html>
<body bgcolor="lightgreen">
<font face="arial" size="5">
<h1> Page 1 </h1>
<br><br>
<form action="welcome.php" method="post">
Name: <input type="text" placeholder="name" name="fname" /> <br>
Age: <input type="text" placeholder="age" name="age" /> <br>
Address <input type="text" placeholder="add" name="add" />
</font>
<input type="submit" value="Ok na" title="Click here to send data." />
</form>
</body>
</html>
welcome.php
<html>
<body bgcolor="lightgreen">
<font face="arial" size="5">
<h1> Page 2 </h1>
<br><br>
Welcome <?php echo $_POST["fname"]; ?>! How are you today<br>
You are <?php echo $_POST["age"]; ?> years old. <br>
Your address is <?php echo $_POST["add"]; ?><br>
</font>
</body>
</html>