how to make a html contact form send message using html [duplicate]

I’m currently doing a project that involves making a contact form for a website. I would like to know how can I make the form send the message to the recipient using html and php. the php code also appears every time I click the send button.

This is what I’ve tried so far.

<form action="POST" action="st.php">
  <p>
    <label for="first">First Name:</label>
    <input type="text" id="firstname" name="user_first">
  </p>
  <p>
    <label for="last">Last name:</label>
    <input type="text" id="lastname" name="user_last">
  </p>
  <p>
    <label for="email">Email:</label>
    <input type="text" id="email" name="user_email">
  </p>
  <p>
    <label for="message">Message:</label>
    <textarea  type="text" id="message" name="user_message"></textarea>
  </p>
  <p class="button">
    <button type="submit" id="submit" name="submit">Send</button>
  </p>
</form>
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Get POST data
    $firstname = isset($_POST['firstname']) ? strip_tags(trim($_POST['firstname'])) : '';
    $lastname = isset($_POST['lastname']) ? strip_tags(trim($_POST['lastname'])) : '';
    $email = isset($_POST['Email']) ? trim($_POST['Email']) : '';
    $message = isset($_POST['message']) ? strip_tags(trim($_POST['message'])) : '';
    $button = isset($_POST['button']) ? strip_tags(trim($_POST['button'])) : '';

    // Validate form fields
    if (empty($first)) {
        $errors[] = 'First Name is empty';
    }
    
    if (empty($last)) {
        $errors[] = 'Last Name is empty';
    }


    if (empty($email)) {
        $errors[] = 'Email is empty';
    } else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $errors[] = 'Email is invalid';
    }

    if (empty($message)) {
        $errors[] = 'Message is empty';
    }
    

    // If no errors, send email
    if (empty($errors)) {
        // Recipient email address (replace with your own)
        $recipient = "[email protected]";
?>