Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP Superglobal - $_REQUEST

<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 = $_REQUEST['fname'];
  if (empty($name)) {
    echo "Name is empty";
  } else {
    echo $name;
  }
}
?>

</body>
Comment

PHP Superglobal - $_POST

<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 = $_POST['fname'];
  if (empty($name)) {
    echo "Name is empty";
  } else {
    echo $name;
  }
}
?>

</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Php :: openclassroom php 
Php :: amazon linux 2 php.ini changes not working 
Php :: How to Allow Users to Delete a Post From the Front-End 
Php :: how to fetch data from database in php and display in pdf 
Php :: show only fatal errors php 
Php :: Codeingiter Pagination 
Php :: chr (PHP 4, PHP 5, PHP 7, PHP 8) chr — Generate a single-byte string from a number 
Php :: Dynamic modal name appending in laravel 
Php :: envato purchase code verfication in php 
Php :: how get database structure in laravel 
Php :: Delete Collection (Get) 
Php :: Accept multiple space separated inputs 
Php :: php send POST request same folder 
Php :: Type cast using int php 
Php :: laravel artisan command run in route 
Php :: how to keep some value on input field 
Php :: provenienza geografica di un utente php webmaster 
Php :: Symfony 5 - Customize Twig error templates 
Php :: how to store api response to avariable in phpp 
Php :: laravel model retrieve 
Php :: php iife 
Php :: letzten 3 zeichen aus einem string entfernen php 
Php :: null php 
Php :: ?? operator in php laravel 
Php :: laravel array update 
Php :: how to append one array to another array in php 
Php :: loop through object php 
Php :: doctrine update entity 
Java :: dependency for spring security 
Java :: spring jpa repository gradle 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =