Are there any specific PHP functions or methods that can be used to show a confirmation message after form submission?
To show a confirmation message after form submission in PHP, you can use the header function to redirect the user to a new page with a message displayed. You can also use session variables to store the message and display it on the redirected page.
// Process form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Process form data
// Set confirmation message
$_SESSION['confirmation_message'] = "Form submitted successfully!";
// Redirect to a confirmation page
header("Location: confirmation.php");
exit();
}
```
In the `confirmation.php` page, you can display the confirmation message using the session variable:
```php
// Display confirmation message
session_start();
if(isset($_SESSION['confirmation_message'])) {
echo $_SESSION['confirmation_message'];
unset($_SESSION['confirmation_message']);
}