Introduction
HTML
page contains many input elements
placed with submit button
. Imagine that we don't know their elements' name or id.
Problem Statement
It is the requirement to retrieve available n number
of text box
values on click of submit button
and without knowing their element names or ids. User entered values are needed to fetch from input elements of HTML page
to PHP
page. And further want to embed the code either in header
or footer
of website page in order to retrieve the values of input fields
without knowing their names.
Example
<!DOCTYPE html>
<html>
<body>
<h2>HTML Forms</h2>
<form action="/action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p>
</body>
</html>
Here, in above HTML code, although input box element names are mentioned. But suppose developer does not know the names and he/she has to fetch every input values without knowing its names.
Query
It is the requirement to work this code in any page after embedding into header or footer
. Any solution would be appreciated.