Adding,removing array elements and accessing via php
<p>I have the following codes. Each time a user click on a photo, its title is pushed into an array. If he clicks again, the title is removed. I want to be able to access the array later on with php so i can populate a database.</p>

<pre><code>function highlight(elem) {
    var e = array();
    if (elem.style.border == '2px solid blue') {
        var index = e.indexOf(elem.parentNode.title);
        e.splice(index, 1);
        elem.style.border = '';
    } else {
        elem.style.border = '2px solid blue';
        e.push(elem.parentNode.title);
    }
}
</code></pre>

<p>Is this the correct way of doing it? How do i access the javascript array with php? </p>
