Pages: [1]   Go Down
Author Topic: Retrieving "GET" HTML Form Data  (Read 1012 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 1
Posts: 137
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,
I am trying to serve a simple webpage with the ethernet shield and arduino dum.   If I have a command such as this:
Code:
client.println("<form name=\"input\" action=\"subnet\" method=\"get\"> Subnet: <input type=\"text\" name=\"newSubnet\"> <input type=\"submit\" value=\"Submit\"> </form>");
What command can I do afterwards to read the form data that was submitted?

Something like a client.read("...");

Thanks for any help
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can print what is received or sent to the serial monitor.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

0
Offline Offline
Full Member
***
Karma: 1
Posts: 137
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But how do I only get the data from the form submission and not all the other stuff?  On this web page I have multiple forms, so how can I specify the form?
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, you are going to get all the "stuff" one character at a time. GET request are fairly short and probably can be captured directly into a string for evaluation. You can use the string function to parse out the desired data from the captured string. I don't think I've delt with the POST request, but if there is a lot of info, you may need to evaluate the characters as they are processed to start a string capture of the material desired when it is encountered.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

0
Offline Offline
Full Member
***
Karma: 1
Posts: 137
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it possible to get some sample code?
This is what I have right now, and I don't think it's working:
Code:
web_browser.println("<form name=\"input\" action=\"password\" method=\"get\"> Password: <input type=\"password\" name=\"PASSword\"> <input type=\"submit\" value=\"Submit\"> </form>");
          String input_password = String(web_browser.read());
Logged

Pages: [1]   Go Up
Jump to: