Does form data still transfer if the input tag has no name?
The W3C specification, if I understand it correctly, mandates that every form input element has a name
attribute specified. Otherwise that element will not be processed. Source
Can you get a forms submitted data even when the input element has no name?
Browsers do not send POST data for elements if they have no name. Therefore you cannot get the values of the inputs.
What is the point of input without name in HTML5?
Not all input is used server-side. In many cases it's used for form submission via AJAX. Additionally, a JavaScript app can make use of user input without ever needing to use a form
.
Html form posting, no data passed on
You should be using the name attribute of input to send the data to a PHP post script. Example:
Form:
<form action="add.php" method="post">
<input type="text" name="firstname" />
</form>
Script (add.php):
<?php
//print the $_POST['firstname'] variable
echo $_POST['firstname'];
?>
Not getting entered data from input element
If you are letting the form submit itself with the inputs from your function, then the problem is that you have not set a name attribute for those inputs. Just give them a name.
Unnamed inputs do not get processed see this answer for further details https://stackoverflow.com/a/12543907/6127393
Stop an input field in a form from being submitted
You could insert input fields without "name" attribute:
<input type="text" id="in-between" />
Or you could simply remove them once the form is submitted (in jQuery
):
$("form").submit(function() {
$(this).children('#in-between').remove();
});
Related Topics
Do I Use ≪Img≫, ≪Object≫, or ≪Embed≫ For Svg Files
Difference Between HTML Div and Span Elements
Keep the Middle Item Centered When Side Items Have Different Widths
How to Line-Break from Css, Without Using ≪Br /≫
Inputting a Default Image in Case the Src Attribute of an HTML ≪Img≫ Is Not Valid
What Is the Correct Value For the Disabled Attribute
Input Type="Submit" VS Button Tag Are They Interchangeable
How to Change Source of ≪Img≫ Tag on Hover
:After and :Before CSS Pseudo Elements Hack For Internet Explorer 7
Html Attribute With/Without Quotes
With Ng-Bind-Html-Unsafe Removed, How to Inject Html
How to Set the Equivalent of a Src Attribute of an Img Tag in Css
Why Are My Css3 Media Queries Not Working on Mobile Devices
How to Set Tbody Height With Overflow Scroll
How to Position One Image on Top of Another in Html
Change Div Order With CSS Depending on Device-Width
Is There a CSS Selector For the First Direct Child Only
Does ≪Style≫ Have to Be in the ≪Head≫ of an HTML Document