Allow user to add any number of text fields on WordPress theme option page

In my theme, there’s a theme option page. I want my users to be able to add any number of texts fields as they want.

This is basically how it should work

Read More
$(document).ready(function () {
    (function () {
        $('.dd').on('click', '.addRow', function () {
            var start = $('#fields'),
                newRow = $('<input type="text" class="quantity" /><br><br>');
            $(start).append(newRow);
        });
    })();
});
<div class="dd">
    <div id="fields">
        <input type="text" class="quantity" /><br><br>
    </div>
    <p class="addRow">Add a Row</p>
    <input type="submit" id="submit" />
</div>

This is how I implemented it on just HTML and JS.

Check jsfiddle

Now I want to store these data in the WordPress DB. So, how this is going to work? How can I integrate PHP with these virtual text fields?

Thanks!

Related posts