Skip to content Skip to sidebar Skip to footer

PHP Submit Does Not Post Text From JS-generated Input Fields

I have a html form that contains a table of text inputs, ultimately to be used to generate an SQL INSERT query. The problem I have is my manually input table has 5 text inputs, the

Solution 1:

Have you checked you have your form tag written properly ? (you should have included it in your question :o) )

<form method=POST action="myURL">
     [...]
</form>

Solution 2:

Though it is a very old question, I am writing the answer in case someone else goes through it again.

The PHP code is not taking values from the newly added input fields with jquery, because they all have the same name attributes. For these kinds of dynamically input fields you need to set the name to an array <input type="text" name "text[]">. When you write, $text= $_POST['text'], the text variable will then store all the values from the input fields with the name text[] and store them in the form of an array.

Hope it helps. :)


Post a Comment for "PHP Submit Does Not Post Text From JS-generated Input Fields"