title: Passing multiple parameters to AJAX JQuery with PHP variables
body: <p>I am trying to pass 2 values to a <code>AJAX</code> <code>JQuery</code> function. </p>
  
  <p>My function is triggered <code>onChange</code> of a drop down list that which gets data from a DB and runs through a <code>while</code> loop and outputs it with <code>PHP</code>, it looks like this:</p>
  
  <pre><code>$dropDown = "&lt;label for='drop_down_list'&gt;Drop Down: &lt;/label&gt;
                  &lt;select name='drop_down_list' id='drop_down_list' onChange='getInfo(this.value, ". $val2 .")'&gt;
                      &lt;option selected='selected' disabled='disabled' value=''&gt;Options&lt;/option&gt;&lt;br/&gt;
                      " . $dropDownOptions . "
                  &lt;/select&gt;&lt;/br&gt;";
  
  echo $dropDown;
  </code></pre>
  
  <p>Here I am trying to send the selected options value, as well as a value I have in a PHP variable (which does have a value because I echo it out elsewhere).</p>
  
  <p>My <code>getinfo</code> function looks like this:</p>
  
  <pre><code>function getInfo(val1, val2) {
      $.ajax({
      type: "POST",
      url:  "get_info.php",
      data: 'value1='+val1+'&amp;value2'+val2,
  
      success: function(data){
              $("#info").html(data);
      }
     });
  };
  </code></pre>
  
  <p>I try to output the values I return from get_info.php like this:</p>
  
  <pre><code>$value1 = $_POST['value1'];
  $value2 = $_POST['value2'];
  
  echo "First Value: " .$value1;
  echo "&lt;br&gt;";
  echo "Second Value: " .$value2;
  </code></pre>
  
  <p>My output is: </p>
  
  <pre><code>First Value: 1
  Second Value:
  </code></pre>
  
  <p>I have error reporting on and I am getting an undefined error on <code>$value2</code> so I think somewhere that PHP variable is not passing properly, I'm not quite sure if that is how I am supposed to properly pass the PHP value I need, am I doing something wrong here?</p>
  
  <p>How can I pass my <code>PHP</code> variable into an <code>AJAX</code> <code>JQuery</code> function and and get the output the values properly?</p>
  
  <p>example:</p>
  
  <pre><code>First Value: 1
  Second Value: 2
  </code></pre>