Hi, I have the Arduino Dum. and the Ethernet Shield based on Wiznet 5100. I have a web page hosted on the Arduino which has forms on it. My question is, how do I read the data submitted by the form and store it as a variable in the Arduino to later use? Here is some sample code of one of the forms on the webpage:
Would I want to do something like a web_browser.read()?
I’ve been told that I can read the data and input it into a string where I can then parse and analyze. But what kind of code should I do to read the form submission?
Take a peek at the ParseHttpHeader() routine. It parses the HTTP POST coming in after a form button is pressed and if a question mark is found in it it sets the viRobsapienUrlCmd variable. This is a primitive way of doing it, as it’s basically just parsing the URL for any kind of parameter and ignoring the rest of the POST request.
You’d be better off with a better parser, looking through an incoming POST request and parsing out the key/value pairs. For debugging, dump the entire POST request out your debug port and then figure out how you want to pull out the data you need. Take a peek at http://www.jmarshall.com/easy/http/#postmethod for a rundown on the syntax.