title: how to send a variable which have not just usual string, from Javascript to PHP and so to be able using in SQL query
body: <p>I want to send my variable from javascript to PHP using post method that needs to be used in SQL query, but my variable value has a special character like &quot; / &quot; that server doesn't perform it,
  it's my sample code:</p>
  <p>js:</p>
  <pre><code>var my_var = &quot;ok1 / ok2_4&quot;; // its my table name in database
  
  $.post(
          &quot;part/order/order_from_js.php&quot;,
          {
          name: my_var,
          },
          function(data) {
          
          // using data .... 
          }
  </code></pre>
  <p>php:</p>
  <pre><code>&lt;?php 
  session_start();
  
  $db=mysqli_connect(&quot;localhost&quot;,&quot;user_db&quot;,&quot;&quot;,&quot;db_name&quot;);
  $name = mysqli_real_escape_string($db, $_POST['name']);// this is my main problem somehow
  
     $select_query = &quot;SELECT * FROM $name&quot;;
  
  $users_query = $db-&gt;query($select_query);
  if ($users_query -&gt;num_rows &gt; 0) {
    
      $i=0;
      while($row = $users_query-&gt;fetch_assoc()) {
         $array[$i]= $row;
  
            $i=$i+1;
      }
  }
  mysqli_close($db);
  
  
  echo json_encode($array);
  
  
    ?&gt;
  </code></pre>
  
  <p>I have an error and nothing will pass back to javascript. I want to persist using mysqli_real_escape_string for avoid SQL injection attack.</p>