ESP8266 Webserver server.on page config
Posted: Wed Nov 16, 2016 9:28 am
Hi
Hope this hasn't be covered before, didn't see anything in the search results. I have a sketch which runs a webserver, with multiple pages, using:-
the config page has a form to submit data (via get) which is written to eeprom, an example field
once this form is submitted, how would I go about handling the request for the page which starts with "/a?ssid=" ? I want something that allows wildcards, as the data entered will vary, but not quite sure how to do this in code. Something like
I have seen an example where the request is monitored using an if statement, like this:-
But I wanted to use the server.on format. Any help much appreciated.
Hope this hasn't be covered before, didn't see anything in the search results. I have a sketch which runs a webserver, with multiple pages, using:-
Code: Select all
server.on("/", handleRoot);
Code: Select all
server.on("/config", handleConfig);
the config page has a form to submit data (via get) which is written to eeprom, an example field
Code: Select all
<form method='get' action='a'><label>SSID: </label><input name='ssid' length=32><BR>"
once this form is submitted, how would I go about handling the request for the page which starts with "/a?ssid=" ? I want something that allows wildcards, as the data entered will vary, but not quite sure how to do this in code. Something like
Code: Select all
server.on("/a?ssid=***********", handleConfig)
I have seen an example where the request is monitored using an if statement, like this:-
Code: Select all
if ( req.startsWith("/a?ssid=") ) {
But I wanted to use the server.on format. Any help much appreciated.