Jump to: navigation, search

PHP HTML GET

From w3cyberlearnings

Contents

PHP $_GET

$_GET gets the HTTP GET REQUEST values.

Syntax $_GET

$_GET['Name']

Note

HTTP GET REQUEST passes information through the URL. It is considered not very secure.

Example 1: Display all the forms elements process by the HTTP GET REQUEST

<?php
if ($_GET) {
print_r($_GET);
}
?>

<html>
<head>
<title>GET</title>
</head>
<body>
<html>
<head>
	<title>Reset password</title>
</head>
<body>
	<p>Provide your email address to reset your password</p>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
		Email:<input type="text" name="email"/><br/>
		<input type="submit" name="rset_pwd" value="Request"/><br/>
	</form>
</body>
</html>
</body>
</html>

Output

Php html get 1.png

Example 2

<?php
if (!empty($_GET['email'])) {
echo 'Your email address: ' . $_GET['email'];
} else {
echo 'Need a valid email address';
}
?>

<html>
<head>
<title>GET</title>
</head>
<body>
<html>
<head>
	<title>Reset password</title>
</head>
<body>
	<p>Provide your email address to reset your password</p>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
		Email:<input type="text" name="email"/><br/>
		<input type="submit" name="rset_pwd" value="Request"/><br/>
	</form>
</body>
</html>
</body>
</html>

Output

Php form get 2.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