看到PHP输出

I have this simple HTML form. and A php script in my computer,

<html>
<body>
<form action="file:///home/tamim/welcome.php" method="post">
Name: <input type="text" name="fname">
Age: <input type="text" name="age">
<input type="submit">
</form>

</body>
</html>

And my welcome.php is

<html>
<body>

Welcome <?php echo $_POST["fname"]; ?>!<br>
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html>

but when I submit., firefox gives me a prompt of what should it do with the welcome.php file? How do I run the php file on submit and see the output in commandline or browser or somewhere else?

Your form action should not be file path.It should be like

<form action="http://localhost/your_proj_folder/welcome.php" method="post">

You can place your IP instead of localhost (and considering that tamim is your folder name where you have placed these files then place your folder name tamim after the localhost)

TO execute a PHP file, you have to put it on a server where PHP installed.

If you are using windows, you can use WAMP or XAMPP as local server

Remove file:///home/tamim/. Just welcome.php

are you running it in local server like XAMPP or WAMP . you have to keep this file in localserver Ex:if you are using wampp keep this file in htdocs and then run.