Bear with me I'm not sure of the correct technical terms of what I'm asking.
Over the last year or so I have been playing with Arduino and Rpi. Little automation projects. Here's an example. I have an Arduino, ultrasonic sensor and relay attached to my desk lamp and screens. When I sit at my desk the Arduino turns my screens and desk lamp on. Then when I leave my desk the Aduino turns the screens and light off after 60 secs.
I would like to create a simple web interface that I can access from any browser (Computer, tab or phone), Like the ones Routers and other programs such as CUPS use.
I know how to write a static web page using HTML and CSS. I know that I would need a web server such as Apache running to serve the page. What I don't know is how do I get the HTML to send or execute a command to the program.
I know if I use an Ethernet shield the Aduino can check the packet header for a particular string and then act accordingly. Is that the same process that say CUPS would use. It seams a bit basic?
Lets say that I have a basic web page with a button to toggle the light. How would I get the web page to send a command when I click the button. I know there is a need for some logic to check the state of the light. i.e.
When button click
if (light var == 0);
light var =1;
else light var =0;
and the command to the Arduino is sent via the serial com or ethernet.
I've been researching this for a while. But the google results generated from my search always point to web apps for iPhones and Android. I don't want to create an App I want a web page. I've managed to work out that I need something like PHP/Java? to perform the function. Am I right in thinking PHP/java is what I need?
I do hope that makes sense

TIA
PP