Every form has an action attribute. That tells the browser what page to load to process the data from the form. You can put that manually as you have so far. However, if you then change the page name the form will stop working. Also you might copy and paste the code to make a new form on a new page.
As part of the $_SERVER superglobal PHP has the name of the current page. You can extract that and use it instead of the manually entered name. In formandprocess.php find this line:
<form method="post" action="formandprocess.php">
and change it to this:
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
This is PHP so you have had to switch back into PHP mode with <?php then echo the page name and then get back out of PHP mode (?>).
Try it and it should work as before. Look at the form HTML source code to see that the echo line has placed the full page file name there (right click on the page in the browser). If you wanted to you could now change the page name but the form would still work.