title: Passing PHP-Variables to Jquery
body: <p>i want to load some data from an sql-table and use them with jquery to color a map.</p>
  
  <p>I picked up the data with PHP:</p>
  
  <pre><code>&lt;?php
    include 'connect.php';
    session_start();
    $userid = $_SESSION['userid'];
  
    $sql = "
    SELECT landstatus.shortland
    FROM landstatus         
    WHERE users_id='1' 
    AND status ='wanttovisit'
    ";
  
    $result = $conn-&gt;query($sql);
  
    if ($result-&gt;num_rows &gt; 0) {
        // output data of each row
        while($row = $result-&gt;fetch_assoc()) {
            echo $row["shortland"]. "&lt;br&gt;";
        }
    } 
    $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>Now i want to use shortland for the static value 'ca' in jquery:</p>
  
  <pre><code>&lt;script&gt;
    jQuery(document).ready(function () {
        jQuery('#vmap').vectorMap({
        map: 'world_en',
        backgroundColor: '#333333',
        color: '#FFFFFF',
        hoverOpacity: 0.7,
        selectedColor: '#727272',
        enableZoom: true,
        colors:{
                'ca' : '#4E7387',
            },
            series: {
              regions: 
              [{
                attribute: 'fill'
              }]
            },
  
        onRegionClick: function (element, code, region) {
          $(".info-box-region").append(region);
          $(".info-box").show();
          $("input[name=region]").val(region);
          $('input[name=code]').val(code);
        }
  
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>At the end colors would be filled with all shortlands from the database - each shortland has the same hex-code.</p>
  
  <p>Thx for helping me.</p>