title: PHP Get Data Attribute From HTML5
body: <p>I've got some problem! </p>
  
  <blockquote>
    <p>I want to show both news-evt and news-ntc content in my web page.
    The JS can POST "news-evt, news-ntc", but the PHP cannot process with this result, how can I do? I am new of php and ajax... Thanks!</p>
  </blockquote>
  
  <p>My Table:</p>
  
  <pre><code>**id**   **category**
    0        news-evt
    1        news-ntc
  </code></pre>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;ul id="blog-filters"&gt;
      &lt;li data-vid="news-evt, news-ntc"&gt;&lt;a&gt;All&lt;/a&gt;&lt;/li&gt;
      &lt;li data-vid="news-evt"&gt;&lt;a&gt;Event&lt;/a&gt;&lt;/li&gt;
      &lt;li data-vid="news-ntc"&gt;&lt;a&gt;Notice&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>My JS:</p>
  
  <pre><code>    $(document).ready(function() {
      $(document).on('click', '#blog-filters li', function(){  
          var last_id = $(this).data("vid"); 
          $.ajax(
          {
              url:"load_data.php",  
              method:"POST",
              data:{last_id:last_id},
              dataType:"text",
              success:function(data) {
                  if(data !== '') {
                      $('.post-item').remove();
                      $('.btn-load-more').remove();
                      $('.blog-content-rows').append(data);  
                  }  else  {  
                      $('.btn-load-more a').html("No More...");  
              }},
          });
      });
  });
  </code></pre>
  
  <p>My PHP:</p>
  
  <pre><code>if (isset($_POST['last_id'])){
  
      require_once('datalogin.php');
      $last_id = ($_POST['last_id']);
      $showLimit = 3;
      $output = '';  
      $id = '';
      sleep(1);
  
      $raw_results = mysql_query("SELECT * FROM article WHERE (category LIKE '%".$last_id."%') ORDER BY date DESC LIMIT ".$showLimit) or die(mysql_error());
  
      if(mysql_num_rows($raw_results) &gt; 0)  {
          while($results = mysql_fetch_array($raw_results)) {
              $id = $results['id'];
              $output .= 'Something Code...';
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Solved: Simply change<code>$last_id = $_POST['last_id']</code> to <code>$last_id = explode(',',$_POST['last_id'])</code> and then add <code>foreach ($last_id as $item) {$raw_results = mysql_query............}</code></p>
    
    <p>New Problem: But there is a Order problem...the foreach loop output 'evt' result first...</p>
  </blockquote>