title: How do I submit a POST variable with Javascript?
body: <p>So I am trying to submit a variable and the name of the variable via a form. I switched a button from submit to button because I need additional validation.</p>
  
  <p>Anyway, here's the button now:</p>
  
  <pre><code>&lt;button type="button" onclick="subForm()" name="del" id="deletebutton" value="'.$org.'"&gt;Delete&lt;/button&gt;
  </code></pre>
  
  <p>Here's my current validation:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function subForm() 
  {
      if(confirm("Are you sure you want to delete this?"))
          document.forms["addorg"].submit();
     else
         return false;
  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And here's my script on the other side:</p>
  
  <pre><code>if (isset($_POST["del"])  &amp;&amp; ($_POST['del'] !== '')) {
      $del = mysql_real_escape_string(html2txt($_POST['del']));
      $resfile = mysql_query('SELECT file_loc from organization WHERE org_id = '.$del);
      $org_name = mysql_real_escape_string(html2txt($_POST['orgname']));
  
      if (!$resfile) 
          header('Location: '.$admin.'?error=query');
  
      while ($filerow = mysql_fetch_array($resfile)) {
          $fileplace = $filerow['file_loc'];
          unlink(".".$fileplace);
          rmdir($org_name);
      }
  
      mysql_query("DELETE from organization where org_id='".$del."'");
      header('Location: '.$admin);
  }
  </code></pre>
  
  <p>It is not currently deleting the records that I want. How do I pass along the "del" name to the other page?</p>