How to access global C variables in html code?
- 6 replies
- 2994 views
I hope this question is not off topic.
I have a board running httpd using a STM32F407. The web server is running CGI and SSI. The cgi file is named index.shtml and is called when the browser first accesses the website.
In the SSI part of the code I populate the browser with check boxes and a input box. The idea is the user will enter text into the text box. I will use the input and update variables in the application.
In the SSI part of the code, I have this code:
if (BLUON == false)
{
char myStr5[] = "<input value=master_port name=\"led\" \"text\">";
strcpy(pcInsert, myStr5);
asm("NOP");
asm("NOP");
return strlen(myStr5);
}The master_port I am using for the input value is a global variable that is assigned a value when the board starts. The value of master_port is 3333. That is what I want to see in the text box when the browser accesses the site. However, as shown in the jpg attached, I just see master_port.
Is there documentation somewhere that can show me how to accomplish what I want? If I enter a new number in the text box, it does not get passed back to either the cgi or the ssi functions in my code. The check boxes do work since they return a value of 1 to the cgi function if they are checked. Apparently there is no such attribute for a text box.
The big problem I have I that I don't have any html experience. I have read some tutorials online but they all reference using php to control incoming data. The STM32 apparently supports Javascript. I need to have 7 text (input) boxes on the webpage. They will be populated with variable data when the web site is accessed. The user will be able to change the data. When it is sent to the board, all the variables will be updated and stored in an on board eeprom.
Do I need to create the text boxes in the html code and use some kind of Javascript to handle user input? Will Javascript allow access to the global C variables that are in the rest of my application code? Is CGI and SSI the way to accomplish this?
