In PHP, what best practices should be followed when embedding form elements within HTML elements for proper functionality?

When embedding form elements within HTML elements in PHP, it is important to ensure that the form elements are properly enclosed within the form tags and that the form action points to the PHP script that will process the form data. Additionally, each form element should have a unique name attribute to properly identify it when processing the form submission.

<form action="process_form.php" method="post">
  <input type="text" name="username" placeholder="Enter your username">
  <input type="password" name="password" placeholder="Enter your password">
  <button type="submit">Submit</button>
</form>