I have a project with multiple html pages and multiple buttons/submits. My Server.On seems to work for some of them but not for others.
page is reset.html
<!DOCTYPE html>
<meta charset=”utf-8″ />
<title>WiFi Reset</title>
<body>
<h1><center>Remove WiFi Credentials</center></h1>
<h2>Clicking the button below will erase the SSID and Password from memory. </h2>
<br>
<form action=”/” method=”POST”>
<center><input class=”button” type=”submit” name=”erase” value=”Erase”><br><br></center>
</form>
<p><a href=”index.html”>Main Menu</a></p><br>
</body>
</html>
What should my server.on be to detect the user pressing the submit button?
In the simple example of the ON/OFF switch, the parsed parameter is the button NAME.
Which prompts the question, if there were ON/OFF buttons on 2 different web pages,
how would you distinguish them as being different? I don't have this exact problem,
just inquiring about general form. Having unique button values would easiy
solve this issue.
It would seem the general form would be something like:
server.on("/webpage/parameter_value")
As best I can determine the general form is: server.on("param_value");
=========
I'd like to see the general form of server.on discussed. You have nice working
examples but I find it challenging to create a more complex project. You are
probably too young (8-) to have been exposed to Backus Naur Format BNF but it
would be useful in some cases. Please consider including links to general
references in your ebooks.
Thanks
Hi.
We have an example like that (multiple input values) in our blog.
You can take a look at it here: https://randomnerdtutorials.com/esp32-esp8266-input-data-html-form/
I hope this helps.
Regards,
Sara