知道点击了什么链接添加到数据库

When clicking on a link I open a modal window, there is a drop down menu, an item is selected and then when submitted I need to know which link was clicked that opened the modal so I can insert the information into the database. The only problem I am having is knowing which link opened the modal. Here is some snipets of my code:

collections.php:

<?php
$query = 'SELECT Song.Song_OID As Song_OID, Song.Title As Song,
    Album.Album_OID As Album_OID, Album.Title As Album,
    Artist.Artist_OID As Artist_OID, Artist.Name As Artist
    From Song
    Left JOIN Artist_has_Song ON Artist_has_Song.Song_Song_OID = Song.Song_OID
    Left JOIN Artist ON Artist.Artist_OID = Artist_has_Song.Artist_Artist_OID
    Left JOIN Album_has_Song ON Album_has_Song.Song_Song_OID = Song.Song_OID
    Left JOIN Album ON Album.Album_OID = Album_has_Song.Album_Album_OID
    ORDER BY Song, Artist IS NULL, Artist, Album IS NULL, Album';
$statement = $pdo->prepare($query);
$statement->execute();
while ($row = $statement->fetch(PDO:: FETCH_ASSOC)) { ?>
<tr>
    <td><a href="#addToPlaylist">+</a></td>
</tr>
<?php } ?>

The link <a href="addToPlaylists">+</a> is what is clicked to open this modal window:

<div id="addToPlaylist">
    <div class="hidden">
        <a href="#close" title="Close" class="close">X</a>
        <form action="addTo.php" method="post">
            <p>Add To:</p>
            <select name="userPlaylists">
            <?php
            $query = 'SELECT Name, Playlist_OID FROM Playlist WHERE User_User_OID=?';
            $statement = $pdo->prepare($query);
            $statement->execute(array($_SESSION['User_OID']));
            while ($row = $statement->fetch(PDO:: FETCH_ASSOC)) {
            ?>
                <option value="<?php echo $row['Playlist_OID']; ?>">
                    <?php echo $row['Name']; ?></option>
            <?php } ?>
            </select>
            <input type="submit" value="Add"/>
        </form>
    </div><!-- end hidden -->   
</div><!-- end addToPlaylist -->

This form then submits and this is the addTo.php:

<?php
require ('../private_html/config.php');
$playlist = $_POST['userPlaylists'];
$song = $_POST['< the part i dont know >'];

$query = 'INSERT INTO Playlist_has_Song (Song_Song_OID, 
            Playlist_Playlist_OID)
            VALUES (?, ?)';
$statement = $pdo->prepare($query);
$statement->execute(array($playlist, $song));   
header('Refresh: 0; URL=collections.php');
?>

The config.php file that is required has the session start as well as the pdo. So given this set up i need to get the Song_OID from the loop that has the #addToPlaylist link into the addTo.php so it can be inserted into the playlist. Any help will be greatly appreciated.

Due to the fact that you also tagged this question as HTML5, you might be interested in using data attributes.

This would allow you use the following HTML:

<tr>
    <td>
        <!-- class song-picker is used to allow for easier element selection -->
        <a href="#addToPlaylist" class="song-picker" data-song-id="<?php echo $row['Song_OID']; ?>">+</a>
    </td>
</tr>

and you could use jQuery to grab the song's id

var songID;
$('.song-picker').on('click', function (e) {
    songID = $(this).data('song-id');
});

This might need some improving, but might server you as a good staring point.