Jump to: navigation, search

PHP HTML HiddenField to Pass data in multiple pages

From w3cyberlearnings

Contents

PHP uses Hidden Fields for multiple page

User hidden field for passing form data to multiple pages. See example for more detail.

Step 1 (1.php)

  • Ask user name
<html>
	<head>
		<title>Full Name</title>
	</head>
	<body>
		<form action="2.php" method="post">
			Name: <input type="text" name="fullname" size="20" maxlength="20"/>
			<input type="submit" name="submit" value="Step 1"/>
		</form>
	</body>
</html>

Step 2 (2.php)

<html>
	<head>
		<title>Email</title>
	</head>
	<body>
		<form action="3.php" method="post">
		Email: <input type="text" name="email" size="20" maxlength="20"/>
		<input type="submit" name="submit" value="Step 2"/>
		<input type="hidden" name="fullname" value="<?php echo $_POST['fullname']; ?>">
		</form>
	</body>
</html>

Step 3 (3.php)

<?php

echo "Name: {$_POST['fullname']} <br/>";
echo "Email: {$_POST['email']} <br/>";
?>

Output

Php form hidden multiple 1.png


Related Links


  1. HTML POST
  2. HTML GET
  3. HTML Textarea
  1. HTML Hidden Field
  2. HiddenField Multiple Pages
  3. HTML Password
  1. HTML Textbox
  2. HTML Checkbox
  3. HTML Radio
  1. Drop down list
  2. Pass value uses URL
  3. Pass value uses URL 2.
  4. Multiple Submit Buttons
Navigation
Web
SQL
MISC
References