Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
$_REQUEST - Used to collect data after submitting an HTML form
SUBMITTED BY:
henry1874w
DATE:
June 17, 2017, 1:19 p.m.
FORMAT:
Text only
SIZE:
443 Bytes
Raw
Download
Tweet
HITS:
214
Go to comments
Report
<!DOCTYPE html>
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="fname">
<input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// collect value of input field
$name = htmlspecialchars($_REQUEST['fname']);
if (empty($name)) {
echo "Name is empty";
} else {
echo $name;
}
}
?>
</body>
</html>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus