Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3694182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:27:58+00:00 2026-05-19T04:27:58+00:00

i cant get the form to post the variables to another script using dynamic

  • 0

i cant get the form to post the variables to another script using dynamic fields?

edit: the script creates a new row of input fields, but none of them manage to post variables to a php script.

jquery:

<script type="text/javascript">
    $(function(){

            var newRowNum = 2;


            $('#addnew').click(function(){
                    // increment the counter
                    newRowNum += 1;

                    var addRow = $(this).parent().parent();


                    var newRow = addRow.clone();


                    $('input', addRow).val($(this).val());
                    $('name', addRow).val('os' + newRowNum);


                    $('td:last-child', newRow).html('<a href="" class="remove">Remove<\/a>');


                    $('input', newRow).each(function(i){
                            var newID = 'os' + newRowNum + i;
                            $(this).attr('id',newID).attr('name',newID);
                    });



                    addRow.before(newRow);


                    $('a.remove', newRow).click(function(){
                            $(this).parent().parent().remove();
                            return false;                           
                    });


                    return false;
            });
    });

html:

<tr>
<td>
<input name="os21" type="text" id="os21" value="" size="24" maxlength="60" /></td>
<td>
<input name="os22" type="text" id="os22" value="" size="24" maxlength="60" /></td>
<td>
<input name="os23" type="text" id="os23" value="" size="10" maxlength="60" /></td>
<td><a id="addnew" href="">Add +</a></td>
</tr>
<tr><td colspan="3" align="left" style="text-align: right; padding-top: 10px;">
<input type="submit" value="Update">
</td></tr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:27:58+00:00Added an answer on May 19, 2026 at 4:27 am
    <script language="text/javascript">
        function postMyForm()
        {
            $.ajax({
                url: "url from your file to post to",
                data: $('#myForm').serialize(),
                type: 'post',
                success: function(data) {
                    // do stuff when request is done
                }
            });
        }
    
        function AddNewRule() {
            // get last ID
            // convert to a int to count with it
            var LastID = parseInt( $('#myTable tr:last td input').attr('id').replace(/os/gi, '') );
            // add 1 to get next ID
            LastID += 1; // OR LastID = LastID + 1;  what you wanna use
    
            // create new rule and set the next ID
            var newRule = $('<tr><td><input name="os'+ LastID +'" type="text" id="os'+ LastID +'" value="" size="10" maxlength="60" /></td></tr>');
    
            // append / insert at the end of your table
            $('#myTable').append(newRule);
        }
    </script>
    
    <form id="myForm">
    <table id="myTable">
        <tr>
            <td>
                <input name="os21" type="text" id="os21" value="" size="24" maxlength="60" />
            </td>
        </tr>
        <tr>
            <td>
                <input name="os22" type="text" id="os22" value="" size="24" maxlength="60" />
            </td>
        </tr>
        <tr>
            <td>
                <input name="os23" type="text" id="os23" value="" size="10" maxlength="60" />
            </td>
        </tr>
    </table>
        <a id="addnew" onclick="AddNewRule();"  href="javascript:void(0);">Add +</a>
    <table>
        <tr>
            <td colspan="3" align="left" style="text-align: right; padding-top: 10px;">
                <input type="submit" onclick="postMyForm();" value="Update">
            </td>
        </tr>
    </table>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following in the web page but can't get a response from
I have a real problem, I can't get sorted out? I have a form
I just can't get my variables to carry over to the next page. The
Can't get to my site. Apache gives the following error message: [Fri Sep 05
I can't get my GridView to enable a user to sort a column of
So this seems pretty basic but I can't get it to work. I have
I think this must be simple but I can't get it right... I have
This sounds dumb, but I can't get it to work. I think i just
We are hosting the swf assets on a media hosting server and can't get
Has anyone managed to use ItemizedOverlays in Android Beta 0.9? I can't get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.