Learn PHP tutorials for beginners

 

How to post data in PHP

For post data superglobals $_GET and $_POST are used in php.:

This is a simple html form

<html>
	<body>
		<form action="index.php" method="post">
			Name: <input type="text" name="name">
			E-mail: <input type="text" name="email">
			<input type="submit">
		</form>
	</body>
</html>

 

PHP file:

<html>
	<body>
		Welcome <?php echo $_POST["name"]; ?>
		Your email address is: <?php echo $_POST["email"]; ?>
	</body>
</html>