Tutorial by Examples

The $_FILES["FILE_NAME"]['error'] (where "FILE_NAME" is the value of the name attribute of the file input, present in your form) might contain one of the following values: UPLOAD_ERR_OK - There is no error, the file uploaded with success. UPLOAD_ERR_INI_SIZE - The uploaded fi...
Data from a POST request is stored in the superglobal $_POST in the form of an associative array. Note that accessing a non-existent array item generates a notice, so existence should always be checked with the isset() or empty() functions, or the null coalesce operator. Example: $from = isset($_...
Data from a GET request is stored in the superglobal $_GET in the form of an associative array. Note that accessing a non-existent array item generates a notice, so existence should always be checked with the isset() or empty() functions, or the null coalesce operator. Example: (for URL /topics.ph...
Usually data sent in a POST request is structured key/value pairs with a MIME type of application/x-www-form-urlencoded. However many applications such as web services require raw data, often in XML or JSON format, to be sent instead. This data can be read using one of two methods. php://input is a...
PHP provides support for the HTTP PUT method used by some clients to store files on a server. PUT requests are much simpler than a file upload using POST requests and they look something like this: PUT /path/filename.html HTTP/1.1 Into your PHP code you would then do something like this: <?p...
Usually, an HTML form element submitted to PHP results in a single value. For example: <pre> <?php print_r($_POST);?> </pre> <form method="post"> <input type="hidden" name="foo" value="bar"/> <button type="su...

Page 1 of 1