title: Pass Selected Radio Value to PHP using onclick, then opening php file to use value in SQL query
body: <p>I am pretty new to coding php and javascript but have manged to scrape my way through so far.  However, I have hit a wall.  I'm not 100% sure that what I'm trying to do can be done, or that I'm even attempting it in an effective way.  </p>
  
  <p>I have a dynamically filled table, made of rows from a SQL statement using php.  On each row is a radio button, each one given a unique value based on the row number (a unique value in one of the database columns).  I am attempting to program a button that enables the user to pass a selected radio button value to a separate php enabled page that will allow the user to edit the row information using the unique row value.  Also, i used the confirm option, because I would also like to add an if else statement that allows the user to cancel, if the wrong row was selected (I haven't attempted that yet because I haven't been able to get the value to pass).  </p>
  
  <p>Page button</p>
  
  <p><code>&lt;input type="button" id="edit_order_button" value="Edit Order"&gt;&lt;/input&gt;</code></p>
  
  <p>JQuery page</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){
  $("#edit_order_button").click(function(){
    var selected = $("input[name ='order_edit_select']:checked").val();
    var r = confirm("Confirm Order Number to edit: " + selected);
    $.post("php/editOrder.php", {
    selected1: selected
    }, function(data,status) {
    //alert("Data: " + data + "\nStatus: " + status);
    window.open("php/editOrder.php","Edit Order","menubar=1,resizable=1,width=750,height=600, left=250, top=50");
  });
  });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>PHP end destination</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  //Login to database (usually this is stored in a separate php file and included in each file where required)
  require('config.php');
  $selected2= isset($_POST['selected1']) ? $_POST['selected1'] : ''; // Fetching Values from URL
  
  echo "Selected Row number is ".$selected2.".";
  
  mysqli_close($connection); // Connection Closed.
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have tried a few things but have so far been unsuccessful in getting the new window to load with the value of the radio button passed.  Currently, the window loads, but the new window only displays the echo text, no variable.  When I run with the alert popup, the data shows me the value of the selected row but it does not seem to be posting to the new page prior to the window.open command.  Any tips would be appreciated, or if i'm approaching the problem from a wrong angle, any insights would also be great.  I have also tried debugging, thinking I was missing a parentheses or semicolon but I wasn't able to find anything.  Thanks </p>