In the example below we have put the HTML form and PHP code in the same PHP file. We have also added some extra lines for security.