push item to div from list of item div : <p>I have a question. I have for example list of div, i just want all these dives should be clickable. And after click on div, value from div should be pushed to on an other div. How I can do it in a best way?</p>

<pre><code>    &lt;?php
define('HOST','xxxx');
define('USER','xxx');
define('PASS','xxxx');
define('DB','xxxxx');

$con = mysqli_connect(HOST,USER,PASS,DB);

$sql = "select * from users";

$res = mysqli_query($con,$sql);
$result = array();

    while($row = mysqli_fetch_array($res)){
    array_push($result,
    array(
      'email'=&gt;$row[3], 
));
} 
echo json_encode(array("result"=&gt;$result));
mysqli_close($con);

?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
#usersOnLine { 
    font-family:tahoma;
    font-size:12px;
    color:black;
    border: 3px teal solid;
    height: 525px;
    width: 250px;
    float: right;
 overflow-y:scroll;
}

.container{
    width:970px;
    height:auto;
    margin:0 auto;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class="container"&gt; 
&lt;div id="reciver"&gt;&lt;h3&gt;reciver&lt;/h3&gt;&lt;/div&gt;
&lt;div id="sender"&gt;&lt;h3&gt;sender&lt;/h3&gt;&lt;/div&gt;
&lt;h2 align="right"&gt; all contacts &lt;/h2&gt;
&lt;div id="usersOnLine"&gt;
&lt;?php
foreach($result as $key =&gt; $val)
{
    echo $val['email'];
    echo "&lt;br&gt;";
}
 ?&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>here is useronline div in which many name are i want when i click on any name name push to reciver div how to made it i am new in php</p>
