It seems Bosse doesn't have proper knowledge about web apps nor web pages.
You are quite right about that concerning "Web apps"! It is the main reason I am asking here...
Web pages in general I do know, I have written sites since the 1990:es using just a text editor...
I wrote a tutorial about that, but unfortunately it's written in Bahasa Indonesia not English, because it's for my fellow Pascal programmers in Indonesia. The tutorial explains from the very basic of HTTP, HTML, CSS, JavaScript, scripting, web server features (based on Apache), communication between web server and our program (in Pascal), etc.
Maybe I can try sending it through Google Translate?
PHP is just ONE of MANY ways to make a web apps. There are many other better ways than using PHP for web apps. Web apps are like desktop app but using web interface (instead of GUI or CLI). So, instead using OS GUI APIs to display things to user, it's using HTML and CSS and using Javascript to make to do the logic (on the browser side). Oh, Javascript is NOT Java.
I looked at your example and realized that:
1) One can use a straight pascal cli program to handle the POST or GET call.
2) One just has to place the program into the cgi-bin dir of the webserver and set its name as the form handler
3) One builds the response page as html in pascal code and put return variable values into that then writes it out as a writeln
So I should be able to do this in my command line programs written with Lazarus!
The easiest way is using CGI since all you need to do is read input from standard input and send output to standard output. Your program response to your web server request by sending output in HTML document along with the required CSS and Javascript code (either internal or external to the HTML document). Your web server reads your response and forward it to the browser that requested at the beginning. That's what happened in every single request and response of HTTP communication.
Some people think that the application part (the program that you wrote to handle web server request) can only be written in PHP. It's very wrong. You can even write it in bash script or batch file. There's nothing that PHP can do and other language can't. My first web app was written in Turbo Pasal 5.5.
Very helpful response! Thank you very much!
I have a few clarification questions:
1) Displaying the main form using a pascal program?
Since I am using web forms for my configuration and status pages it would be better if I can synchronize the web form and processing inside the pascal program by having the actual page display also controlled by the pascal code. One less thing to get out of sync....
So can I display my config using an url such as this:
http://rpimonitor/cgi-bin/mainpage
Where mainpage is my pascal program for showing the main page...
Or maybe cgi-bin is not directly available on the browser (I think it is typically located above the document root) so I may need an index.php file on the server that calls the cgi-bin script? If so how would that be done?
2) Form handler type GET and POST?
The two types I know of are POST and GET where the submit button will in the GET case put the input data into the URL itself whereas in the POST case the data is sent in another way, which I don't know how...
When dealing with form handlers there are different ways to deal with that in PHP, how does it work in cgi pascal programs?
Say I use the POST method in the form, how do the data arrive into the pascal cmd line program?
Grateful for your input!"