Home>

Questions about html and php
(Since I don't know about html and php, I can't fully understand it, but I will do my best)

We are creating a service that can be used by opening an html file in a browser without using a web server.

I am coding for the face-up display displayed in the browser in htmlTest.html.
In htmlTest.html, create a form button, specify phpTest.php for action, and use the submit button to pass the value entered in the form input field to phpTest.php for processing.

(specifically
Create input fields and submit button in htmlTest.hrml
Processing to receive the number entered in the input field in phpTest.php and return the calculated result
)

But if you open htmlTest.html on your browser,
Both the input field and the send button are displayed.
When you press the send button, all the code written in phpTest.php is displayed on the browser as it is.

I have investigated a lot,
What about web server, how about localhost, how about ESET, how about XAMPP, etc.
There was nothing that fits my situation. (It may be just not found)

By the way, I'm trying to use it by opening the file in the browser, so
The URL when opened in a browser is
file: /// ~.

I'd like you to tell me anything that seems obvious.

  • Answer # 1

      

    The URL when opened in a browser is
      file: /// ~.

    To display in a browser, you need to start a server that runs PHP and place PHP there.
    "What about XAMPP" is when you are using a local server environment.

  • Answer # 2

    Look for past questions. A question that has been posted many times.

    In the first place, since php is a server side language, it will not work unless it is executed on the web server.
    In other words, it does not execute directly in a file like file: // ~, but it must be placed on a Web server and accessed in the form of http: // ~.
    XAMPP is an easy way to build a web server on a Windows PC.
    By the way, "MAMP" is more appropriate for MacOS.
    It is better to read the commentary. First, from "Hello World" in php

    * In other words, it's impossible to use "without a web server"