• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Server.on questions and general form

Q&A Forum › Category: ESP32 › Server.on questions and general form
0 Vote Up Vote Down
Barry asked 2 years ago

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


Question Tags: webserver
1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

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

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.