What are the potential pitfalls of using the same name for multiple input fields in PHP forms and how can they be avoided?

Potential pitfalls of using the same name for multiple input fields in PHP forms include difficulty in distinguishing between the values submitted, as PHP will overwrite the previous value with the latest one. To avoid this issue, unique names should be assigned to each input field.

<form method="post" action="process_form.php">
    <input type="text" name="username" placeholder="Username">
    <input type="text" name="email" placeholder="Email">
    <input type="submit" value="Submit">
</form>