-->
Page 1 of 1

HTML page data handling in nodeMCU

PostPosted: Wed Jul 05, 2017 1:07 pm
by Abhilash R
Hi,

I have a NodeMCU which I am using in the access point mode. I use this mode to host a html page with a webserver code I have written. In the html page, I basically use a form to take in home Wi-Fi credentials to use it when in station mode. The values in those fields get passed on (I have attached a screenshot showing the same). But, when I use the following code to use those values, I am not able to use any of it.
Code: Select allif (server.args() > 0 ) {
    for ( uint8_t i = 0; i < server.args(); i++ ) {
      if (server.argName(i) == "fname") {
         // do something here with value from server.arg(i);
      }
   }
}

server.args() gives a value of 0 and the program doesn't enter this loop at all. What am I doing wrong and how can I correct that? Any help is much appreciated.

Thanks!

Re: HTML page data handling in nodeMCU

PostPosted: Thu Jul 06, 2017 9:36 am
by martinayotte
Without showing us the HTML code, it is hard to see where is your issue ...
Are you doing a FORM to POST your fields ?
Do you have a separate URL for the POST ?

Check this example to inspire you :
https://github.com/esp8266/Arduino/blob ... cation.ino

Re: HTML page data handling in nodeMCU

PostPosted: Thu Jul 06, 2017 11:32 am
by QuickFix
martinayotte wrote:Without showing us the HTML code, it is hard to see where is your issue ...

Your crystal ball is away for maintenance again? :lol:

Re: HTML page data handling in nodeMCU

PostPosted: Fri Jul 07, 2017 2:25 am
by Abhilash R
martinayotte wrote:Without showing us the HTML code, it is hard to see where is your issue ...
Are you doing a FORM to POST your fields ?
Do you have a separate URL for the POST ?

Check this example to inspire you :
https://github.com/esp8266/Arduino/blob ... cation.ino


The HTML code for this is in my laptop at home. I will share the code when I get home from work. Thank you so much for the response. And, also for the link. I shall check that out.