Retrieving Submitted Data

Once the data if filled up in forms. In order to retreive data use the similar approach as :

// formtest2.php
if (isset ( $_POST ['name'] )) {
	$name = $_POST ['name'];
} else {
	$name = "(Not entered)";
	<title>Form Test</title>
		Your name is: $name
		<br />
		<form method="post" action="formtest2.php">
			What is your name?
			<input type="text" name="name" /> 
			<input type="submit" />

The only changes are a couple of lines at the start that check the $_POST associative array for the field name having been submitted. The previous topics introduced the $_POST associative array, which contains an element for each field in an HTML form.


You may also like...