Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

php
forms

PHP $_POST

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

PHP $_POST is an associative array of variables passed to the current script via the HTTP POST method.

$_POST is a superglobal variablevariable that is accessible anywhere regardless of scope used to collect form data after submitting an HTML form with method="post".

Example

In this example, we have an HTML form with method="post". The data submitted (the message input) can be accessed once the form is submitted using $_POST['message'].

<?php 
   if(isset($_POST['submit'])){ 
      echo $_POST['message'];
   }
?>
<html>
<body>
   <form method="post" action="">
      <input type="text" name="message">
      <input type="submit" name="submit">
   </form>
</body>
</html>

RELATED TAGS

php
forms
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring