Monday 8 February 2016

Post value from a form to another page in PHP

Code:

index.php

<!DOCTYPE HTML>
<html>
<body>
<center>
<h1>Page to post</h1>
<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>
</center>
</body>
</html>



welcome.php 

<!DOCTYPE html>
<html>
<body>
<center>
<h1>Posted page</h1>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</center>
</body>
</html>

Output:


No comments:

Post a Comment