Q:

How can I ajax several forms?

I have this PHP code that's produce several forms :
<?php
while($result = $mods->fetch()) {
    echo "<form><input type='text' name="variable-name" /><input type='submit' name='submit' value='Submit'></form>";
    }
?>

I use this Jquery code for ajaxing this form:
$(document).ready(function() {
    $('#form form').submit(function(){
        $('#content').load('data.php', { 'name': $('input[name='variable-name']').val()});                      
        return false;
    });
});

But my Jquery code need input[name='variable-name'] that's variable for each input.
How can I use this names in this Jquery code?

A:

EDITED
This should work,
<?php
while($result = $mods->fetch()) {
    //Assuming you get dynamic id like this
    $dynamic_id = //some method

    echo "<form><input type='text' class='my_input' name='variable-name-$dynamic_id' /><input type='submit' name='submit' value='Submit'></form>";
    }
?>

$(document).ready(function() {
    $('#form form.my_form').submit(function(){
        var input = $(this).find('input.my_input');
        $('#content').load('data.php', { 'name': input.val()});                      
        return false;
    });
});

