too long

I have this function http://jsfiddle.net/wnFsE/ . As you can see every time the user writes a languages on the textfield and then hits the button add a new language is added to the list. Then when the user hits save, all the info is sent with POST.

Until now, everything is ok. BUT, when the user sends the info, the info is stored on my MySQL database. So, every time when the user comes again to the page, he needs to see the languages already saved in the last session.

In my PHP script every time the user comes, I retrieve the languages from my database, but I don't know how to add them to the list. The solution would be call the $("#add").click(function() { from the PHP script who retrieve the data from the MySQL, but I don't know how to do this.

If it serves for any help, this is the simple PHP function which retrieves the languages from the user:

function list_lang() {
    $this->DBLogin();
    $result = mysql_query("SELECT * FROM ".table_lang." WHERE id_user=1");
    while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo $row['lang']." ".$row['level']."<br>";
        //instead of the echo, here will be the call to jquery (if possible)
    } 
}

A simple soloution:

$buildHTML = '';

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $buildHTML .= '<li>'.$row['lang'].'<input type="hidden" name="languages[]" value="'.$row['lang'].'" /><a href="#" class="remove_lang">Remove</a></li>';
}

And then have

<script type="text/javascript">
    var UserLangs = <?php echo $buildHTML; ?>;

    $('#langs').append(UserLangs);
</script>

You can do this way:

<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<script type="text/javascript">
...
...
listitem_html += <?php echo $row['lang']. $row['level'] . '<br>'?>;
...
...
</script>
<?php
} 
?>