send-form.php - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of send-form.php.php

  1. <?php
  2.     if (isset($_POST['submit'])) {
  3.         $name = $_POST['name'];
  4.         $email = $_POST['email'];
  5.         $message = $_POST['message'];
  6.         $to = '[email protected]';
  7.         $subject = 'New Contact Form Submission';
  8.         $headers = "From: " . $email;
  9.         $message = "Name: " . $name . "\n" . "Email: " . $email . "\n" . "Message: " . $message;
  10.         
  11.         mail($to, $subject, $message, $headers);
  12.         echo "Thank you for your submission!";
  13.     }
  14. ?>
  15.  
File Description
  • send-form.php
  • PHP Code
  • 26 Jan-2023
  • 483 Bytes
You can Share it: