How do I print all POST results when a form is submitted?

To print all the POST results when a form is submitted with PHP, you can use the print_r($_POST) function. This will print an array of all the POST variables and their values.

Here is an example of how you can use this function:

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Print the POST array
    print_r($_POST);
}

Watch a course Learn object oriented PHP

This code will check if the request method is POST, and if it is, it will print the $_POST array. The $_POST array is a superglobal array in PHP that contains all the POST variables and their values.

You can also use the var_dump($_POST) function to print more detailed information about the $_POST array, including its data type and size.

We hope this helps! Let us know if you have any questions.