Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML/JQuery form not posting to PHP
    primarykey
    data
    text
    <p>So I've built hundreds of forms before, all with no issues, but for some reason unknown to me this one doesn't seem to be working. This form is in its infancy to later be plugged into a larger web application. I've checked my code over and over again, checked if PHP is functioning properly, etc, yet I've had no luck fixing my issue.</p> <p>The problem is that I cannot access any of the data within my form from PHP. Even further, once the form is posted it does not append the form data to the URL. Instead I just get <code>www.example.com/list.php?</code></p> <p>Hopefully I've just overlooked something, but the only other thing I can possibly think of is it has something to do with JQuery. If you guys could just take a look at my code and see if there are any glaring errors I would really appreciate it.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;list&lt;/title&gt; &lt;script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'&gt;&lt;/script&gt; &lt;script&gt; $(window).load(function(){ var counter = 1; $('button.remove').click(function(){ if(counter &gt;= 1){ $("#cnt" + counter).remove(); counter--; $('#count').attr('value', counter); } }); $('button.add').click(function(e){ e.preventDefault(); counter++; $('#count').attr('value', counter); var newData = '&lt;tr style="display:none" id="cnt' + counter + '"&gt;&lt;td&gt;&lt;input type="text" value="Content' + counter + '"/&gt;&lt;/td&gt;&lt;/tr&gt;'; $(newData).appendTo('#myTable').fadeIn('slow').slideDown('slow'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;button class="add"&gt; + &lt;/button&gt;&lt;button class="remove"&gt; - &lt;/button&gt; &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="get"&gt; &lt;table id="myTable"&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" value="Content1" id="cnt1" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input type="hidden" id="count" value="10" /&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; &lt;?php echo $_GET['count']; ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload