This question already has an answer here:
I began following a tutorial about PHP. Reached the form handling. But here it is: when I do what they say and press Submit, it gives me to save the .php file instead of executing it? What am I missing here?
</div>
It is a misconfiguration of the server. Perhaps the recommendations here could help. Either PHP isn't installed or Apache was not configured.
You are missing an HTTP server that supports PHP and is configured to use it. PHP (in the context on the WWW) is a server side technology.
You may not actually be running a web server, and instead may be simply loading local files in your web browser. Install an easy setup web server and PHP setup package. On Windows, WAMP is recommended. On MacOS, the equivalent is MAMP
Rather than opening files from your local drive, you then access them as (for example):
http://localhost/your_php_file.php
You are missing the Apache server and required PHP installation.
If you are on windows. Go to this link Wamp and select Downloads and download the latest version of Wamp.
For Mac OS you can use Mamp
Download and install it in your machine.
If you are on Linux - Ubuntu you can do:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
After installation place your php code in configured folder where the php is set to run and then go to browser and take the url : http://localhost/yourphp.file
.
Hope this helps