title: How use variable php in javascript for 2 fuction?
body: <p>So i want use 2 function java Script for automatically add the new column when the contents and autosuggestion, this for example coding automatically add the new column when the contents <a href="http://jsfiddle.net/3jLbm9sp/1/" rel="nofollow">http://jsfiddle.net/3jLbm9sp/1/</a> so when i try input in first column, he will be give auto suggestion for first column and add new column(second column) and give autosuggestion too. but i cant This is all my coding :</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;form method = "POST" action="text.php" &gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
          &lt;title&gt;Admin&lt;/title&gt;
          &lt;link href="css/inputpo.css" rel="stylesheet"&gt;
          &lt;link rel="stylesheet" href="css/jquery-ui.css"/&gt;
          &lt;script src="js/jquery-1.9.1.js"&gt;&lt;/script&gt;
          &lt;!--For Auto Suggestion --&gt;
          &lt;script src="js/jquery-ui.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
          $(document).ready(function(){
              $("#code1").autocomplete({
                  source: 'autosuggest.php',
                  select:function(event, ui){
                              $('#descrip1').val(ui.item.descrip1);                           
                  }
              });
          });
          &lt;/script&gt;
          &lt;!--For Auto Add New Colomun--&gt;
          &lt;script type="text/javascript"&gt;
          var data = &lt;?php echo json_encode($code1); ?&gt;;
              $txt=new Array();
              $(function(){
                  $('#go').on('click',function(){
                      console.log($('form').serialize());
                  })
  
                  $('body').on('keydown','.last',function(){
                      $('.last').removeClass('last');
                      $('#go','body').before(
                      '&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;input class="last" type="text" id="code1" name="code'+(Number($(this).attr('name').match(/[0-9]+/g))+1)+'" value=""&gt;&lt;/td&gt;
  </code></pre>
  
  <p><code>');<br>
                      })
                  })</code>
              </p>
  
  <pre><code>    &lt;/head&gt;
      &lt;body&gt;
      &lt;?php
  $code1="";
  if($_GET) {
  $code1      = isset($_POST['code']) ? $_POST['code1'] : '';
  $descrip    = isset($_POST['descrip1']) ? $_POST['descrip1'] : '';
  
  }
  ?&gt;
          &lt;div class="isi"&gt;
                  &lt;table height="51" border="0" cellspacing="2"&gt;
                  &lt;tr&gt;
                      &lt;td width="99" align="center" label for="suggestionbox"&gt;
                          &lt;div align="center"&gt;Code&lt;/div&gt;&lt;/label&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;div align="center"&gt;Description&lt;/div&gt;
                      &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                  &lt;td&gt;
                  &lt;input  class="last"  type="text" id="code1" name='code1' value="&lt;?php echo $code1;?&gt;"&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                  &lt;input  class="last"  type="text" id="descrip1" name='descrip1' value=""&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
              &lt;/table&gt;
                  &lt;input id="go" name="" type="submit" /&gt;&lt;/td&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>if i only use autosuggestion it's work but cant add new column, and if i use add new column, I can not get auto suggestion, when i check the fail Function is in here</p>
  
  <pre><code>type="text" id="code1" name="code'+(Number($(this).attr('name').match(/[0-9]+/g))+1)+'" value=""&gt;
  </code></pre>
  
  <p>if value is empty ="" its work for add new column,and where for autosuggestion variable (PHP) is $code1, so i try write in value=""> does anybody know how to write php variable inside a javascript function? can use another like ajax, but i don't know how.</p>