Using PHP forms

Hello guys, I know a bit of electronics but I am completely new to web programming.

I am making a home project in which I need to send some data to my arudino UNO board connected to the USB port of the PC over the web.

I saw on the forum that probably I need to use PHP serial library for that purpose.

But my problem is related to PHP if anyone can help. I plan to make a webpage with a number of radio buttons and a submit button for each pair of radio buttons. As I have seen in the tutorial for HTML and PHP the forms use POST method when the submit button is pressed and send some data to a page with the PHP script. But, I want it such that when I press the submit button instead of going to a new page just the commands for opening the USB port, sending the data associated with the particular selection of the radio buttons the user makes is sent. Can this kind of thing be done directly? Or do I have to use another method?

I would have included the code but I haven't written any at this moment because I am not able to figure this thing out right now.

Sorry if it is too obvious or I am just plain stupid. I am not asking for a code, just some directions :)

I saw on the forum that probably I need to use PHP serial library for that purpose.

What you might have seen was that PHP is one way to accomplish that goal. It is by no means the only way.

I plan to make a webpage with a number of radio buttons and a submit button for each pair of radio buttons. As I have seen in the tutorial for HTML and PHP the forms use POST method when the submit button is pressed and send some data to a page with the PHP script.

What is going to serve up that web page? The action method for the form typically executes on the same server that served up the form page in the first place. If that action method is another (or the same) PHP script, that script can open the serial port, and send data. It gets that data from the $_POST array.

The action PHP script can re-direct to a new page, or not. That action is completely up to you.

Thank you PaulS. I am going to host the webpage on my PC. The online tutorials that I saw, all of them looked like you HAVE to get to another page. Now that you have cleared my doubt I hope to carry on with the process.

The online tutorials that I saw, all of them looked like you HAVE to get to another page.

There is no default action to display a different page. Typically, people fill out fields in a form (like user id and password, for example) and click the submit button (which can have any text on it), and they expect to be directed to a different page. If the page is a login page, and you get the login page back, that's not very useful, is it?

But, you can make the new page be the same as the old page, if that is appropriate.

Now, I am feeling a bit stupid. Got it now. Thanks :slight_smile: