title: How do I check a javascript submitted form using the POST global
body: <p>Image one is how the page appears when loaded by the browser. Image 2 is when the list element is double clicked. Image 3 shows the result of clicking the pencil (which is the original form element). You can see that the list item does have an accessible value as it prints the integer in the alert so I am not sure about the comment below pertaining to that . I am also not understanding  how this is a duplicate of the previous question suggested as when the img is clicked it satisfies the logic check of $_POST['edit']. Please do not mark this as duplicate as it is not! In the answer my question was marked as a duplicate of it is stated that "img input elements cannot post data to the server and must be encased in a button". This to my mind must be incorrect as how can my page change state based on the img click if it is not delivering data via post, how can the POST variable be set by the img click if it cannot pass data to the server. If a question is marked as duplicate then the original answer must address the same problem and/or contain correct information if it does not then I fell this question should stand as an original! </p>
  
  <p><a href="https://i.stack.imgur.com/WtzSc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WtzSc.png" alt="when page loads"></a></p>
  
  <p><a href="https://i.stack.imgur.com/MUHiL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MUHiL.png" alt="when double clicking li element"></a></p>
  
  <p><a href="https://i.stack.imgur.com/lRwL5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lRwL5.png" alt="enter image description here"></a></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script  src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;?php
    if(isset($_POST['edit']) ) 
    {
    ?&gt;
      &lt;p&gt;window is in edit mode&lt;/p&gt;
    &lt;?php
    }
    else
    {
    ?&gt;
      &lt;p&gt;window is not in any mode&lt;/p&gt;
      &lt;form id="form-edit"  method="POST" name="form-edit"  action=" &lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
        &lt;input type="image" id="edit-button" name="edit" value="1"  src="../images/pencil.png" class="course-banner-edit"&gt; 
      &lt;/form&gt;
      &lt;?php
      }
      ?&gt;
      &lt;script&gt;
        $(document).ready(function() {
  
         /**********************************************
         PROBLEM WITH THIS FUNCTION 
         **********************************************/  
          $('li').dblclick(function() {
            $('#form-edit').submit();
         /******************************************
        THE ALERT TRIGGERS AND THE VALUE IS REPORTED AS ONE WHICH IS CORRECT
          *****************************************/  
            alert( $("input[name=edit]").val() );
          });
       }); 
       &lt;/script&gt; 
     &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>