title: Share a string or part of page on Facebook
body: <p>I want to share a part of a page with Facebook ... this should be easy keeping in mind the scale of Facebook and the research that has been put into it. I have below loop which is fetching data from a $wpdb->select query and at the end of the loop I want a Facebook button but on click only that particular row of my MySQL table should be shared on Facebook. I know about <a href="https://developers.facebook.com/docs/plugins/share-button" rel="nofollow">https://developers.facebook.com/docs/plugins/share-button</a> to get the Facebook share code but how can I use this to share only the current value of my loop. Thanks any idea !! Below is my query and foreach loop ... I am not getting hold of it how this can be done.</p>
  
  <p>PHP Code</p>
  
  <pre><code>global $wpdb;
  $sqll = "SELECT articles.aid, articles.username, articles.competition, articles.path, articles.category, articles.title, SUBSTR(articles.body, 1, 512) As articlebody, articles.body, Sum(zvotes.zvotes) AS votessum FROM articles LEFT JOIN zvotes on articles.aid=zvotes.aid WHERE articles.category = '$cat' &amp;&amp; articles.competition = '$comp' GROUP BY articles.aid, articles.username, articles.competition, articles.path, articles.category, articles.title ORDER BY articles.aid DESC";
  
  $results = $wpdb-&gt;get_results($sqll) or die(mysql_error());
  $response=array();
   if( is_array($results) &amp;&amp; count($results) &gt; 0  )
   $form="";
  
  foreach( $results as $result ) {
  $form.= '&lt;form id="voteform" action="" method="post"&gt;';
  $form.= "&lt;input id='aid' name='aid' type='text' value='$result-&gt;aid'&gt;";
  $form.= "&lt;div id='tsm'&gt;&lt;/div&gt;".'&lt;br&gt;';
  $form.= "&lt;input id='category' name='category' type='hidden' value='$result-&gt;category'&gt;"; 
  $form.= "Title :".$result-&gt;title.'&lt;br&gt;';
  $form.= "&lt;div class='mg-image' style='margin-top:15px;'&gt;&lt;img id='articlecontest' src='$result-&gt;path' width='250' height='250' &gt;&lt;/div&gt;" . '&lt;br&gt;&lt;br&gt;';
  $form.= "&lt;input id='competition' name='competition' type='hidden' value='$result-&gt;competition'&gt;";
  $form.= "Username :".$result-&gt;username.'&lt;br&gt;';
  $form.= "&lt;input id='sumofvotes' name='sumofvotes' type='hidden' value='$result-&gt;votessum'&gt;";
  $form.= "&lt;div class='myvotes'&gt;&lt;div id='total'&gt;"."Total Votes:".$result-&gt;votessum."&lt;/div&gt;&lt;/div&gt;".'&lt;br&gt;';
  $form.= "&lt;div id='articlesummary'&gt;".$result-&gt;articlebody."&lt;/div&gt;";
  $form.="&lt;div id='clickme' style='color:blue; font-size:16px; font-family: Satisfy, Cursive;'&gt;".'READ MORE'."&lt;/div&gt;";
  $form.= '&lt;div id="articlebody"&gt;'.'This is body text'.$result-&gt;body.'&lt;/div&gt;';
  ///////////////
  $form.="&lt;input class='star' id='star1' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/checkmark-small-unfilled.png' value='1' style='border:0px!important;'&gt;";
  $form.="&lt;input class='star' id='star2' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/checkmark-small-unfilled.png' value='2' style='border:0px!important;'&gt;";
  $form.="&lt;input class='star' id='star3' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/checkmark-small-unfilled.png' value='3' style='border:0px!important;'&gt;";
  $form.="&lt;input class='star' id='star4' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/checkmark-small-unfilled.png' value='4' style='border:0px!important;'&gt;";
  $form.="&lt;input class='star' class='star' id='star5'  type='image' type='submit'  name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/checkmark-small-unfilled.png' value='5' style='border:0px!important;'&gt;&lt;/form&gt;";
  ///////////////
  
  }//end of foreach
  $response['form']=$form;
      echo json_encode($response['form']);
      exit();
  
  }
  ///////////////////////////////////
  add_action( 'wp_ajax_star', 'star' );
  add_action( 'wp_ajax_nopriv_star', 'star');
  </code></pre>