Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with posting data in PHP
    text
    copied!<p><strong>Issue</strong></p> <p>I have a script that's been running fine since forever. It never gave any issues. It was last used in December with no issues whatsoever. No one changed anything. But now, it doesn't work. What it's supposed to do is submit a review and then notify users about the review. But it's not entering that section were it saves and notifies.</p> <p><strong>What I Have Done And Results</strong></p> <p>I have taken out that specific piece of the script that saves and notifies users, and tested it. It doesn't return anything which means it doesn't enter it. I've checked the post data, and that displays correct. I have also forced correct data to be posted (by changing <code>params = $('#reviewForm').serialize();</code> to <code>params = 'counter=1'</code>.</p> <p><strong>My Code</strong></p> <p>Here is the form that is filled in by the user:</p> <pre><code>&lt;form id="reviewForm"&gt; Employee that will be reviewed: &lt;input type="text" id="reviewed" name="reviewed" class="items"/&gt;&lt;br&gt; &lt;div id="openReviews" class="ui-corner-all ui-state-error" style="padding: 5 5 5 5"&gt;&lt;/div&gt; Employees that will do the review:&lt;br&gt; &lt;div id="reviewee_1"&gt; &lt;ul&gt;&lt;b&gt;Employee 1:&lt;/b&gt; &lt;li&gt;Name: &lt;input type="text" id="reviewer_1" name="reviewer_1" class="items"/&gt;&lt;/li&gt; &lt;li&gt;Position: &lt;select id="position_1" name="position_1" class="items"&gt; &lt;option value="sup"&gt;Supervisor&lt;/option&gt; &lt;option value="supp"&gt;Peers: Support&lt;/option&gt; &lt;option value="tech"&gt;Peers: Technical&lt;/option&gt; &lt;option value="sub"&gt;Sub-Ordinate&lt;/option&gt; &lt;/select&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;input type="hidden" id="counter" name="counter" value="1" class="items"/&gt; Add Another Reviewer &lt;input type="button" id="add" value="Go &gt;&gt;"/&gt;&lt;br&gt; &lt;input type="button" onClick="sendInfo()" value="Create Review"/&gt; &lt;/form&gt; </code></pre> <p>When Create Review is clicked, it calls this piece of jQuery code:</p> <pre><code>function sendInfo() { if($('#reviewed').val() != "") { var params = $("#reviewForm").serialize(); $.post('reviews.php', params, // as stated, even if I change this to counter = 1, it doesn't work function(data) { $('#reviewForm').hide(); $('&lt;p&gt;' + data + '&lt;/p&gt;').insertBefore('#reviewForm'); }); } else { alert("Please complete all fields in this form!"); } } </code></pre> <p>And then lastly, the code that processes the request:</p> <pre><code>if($_POST['counter'] &gt; 0) // check if review was submitted { // do stuff... // it doesn't even enter this... } </code></pre> <p><strong>Question</strong></p> <p>Did something change in the PHP or jQuery specs that could cause this to stop working? Is there something that I'm missing? What's going on!?</p> <p>Please help!</p>
 

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