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

  • SEARCH
  • Home
  • 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 7835463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:38:45+00:00 2026-06-02T13:38:45+00:00

On my page I have multiple forms all the same as this… <form class=’bill-upd’>

  • 0

On my page I have multiple forms all the same as this…

<form class='bill-upd'>
   <input type='hidden' value='".$info['rand']."' name='rand2' id='rand2'>
   <input type='hidden' value='".$info['id']."' name='billid' id='billid'>
   Total <input type='text' id='total' name='total' /><br />
   Bill name<input type='text' id='bill-name' name='bill-name' /><br />
   bill descriptiion <input type='text' id='bill-description' name='bill-description' /><br />
   bill colour<input type='text' id='bill-colour' name='bill-colour' />
   <input type='button' value='submit' onClick='updateBill();' />
</form>  

I then have my AJAX as so

function updateBill()
{
    $.post('update_bill.php', $('.bill-upd').serialize(), 
        function(data) {
        $(this).append(data);
    });
};

If I have one form on my page, this works fine, but when there are multiple instances, my same record is being overwritten, can anybody tell me where im going wrong?

Thanks


With the help of @Armatus and @Bricriu I got it sorted, the answer as marked worked, stupidly forgot to wrap it within document.ready

  • 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-06-02T13:38:46+00:00Added an answer on June 2, 2026 at 1:38 pm

    You need a way to specify which bill you’re updating, otherwise it just takes all of them. This should work, since we can determine which one it is by which button was clicked.

    Edit: I personally would bind the even using jQuery rather than onClick on the element itself:

    $(".bill-upd input:submit").click(function(){
        var elem = $(this);
        $.post('update_bill.php', elem.parent('.bill-upd').serialize(), 
            function(data) {
            elem.append(data);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple forms on the same page but I want to submit all
I have this form with multiple checkboxes with same name and all of checkboxes
I have multiple ajax forms on page that cointain same elemets, I have jquery
I need to have multiple forms in the same webpage, all of them POSTing
Have a page where there are multiple input fields of the same thing, Posts.
I have a page with multiple forms, however all forms need to take the
Have a page where there are multiple input fields of the same thing, Posts.
I have multiple select boxes on the page all of which share the same
I have multiple forms on a page, for each of them I want the
I have a page with multiple forms that I submit via Ajax POSTs serially.

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.