2 Replies Latest reply on Nov 19, 2008 2:10 AM by jimbo2k

    All forms on a page submit regardless of button clicked

    jimbo2k
      Hello, I hope you can help me.

      I'm fairly new to website development, but I'm trying to build a PHP / mySQL driven web application and slowly getting somewhere! However, I'm stuck with some odd behaviour from my HTML forms.

      I have an 'Order' table populated with SQL database info, like an online shopping basket. There's a Model Number and a Price column. There are also two more columns, each containing an HTML form:

      The first form is meant to Update my SQL database with the value entered in the Price field.
      The second column is meant to Delete the record from my SQL database.

      The row is a repeat region to show all line items in the order.

      The Update form used to work just fine. However, having added the Delete form in the adjacent column, regardless of whether I submit the Update or Delete form, the record gets deleted. It seems that whichever Submit button I click, both forms get submitted. Is this normal?

      How do I stop this?

      Thanks!
        • 1. Re: All forms on a page submit regardless of button clicked
          Level 7
          Please post a link to your page so we can see your form code.

          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          ==================


          "jimbo2k" <webforumsuser@macromedia.com> wrote in message
          news:gfuqic$gbn$1@forums.macromedia.com...
          > Hello, I hope you can help me.
          >
          > I'm fairly new to website development, but I'm trying to build a PHP /
          > mySQL
          > driven web application and slowly getting somewhere! However, I'm stuck
          > with
          > some odd behaviour from my HTML forms.
          >
          > I have an 'Order' table populated with SQL database info, like an online
          > shopping basket. There's a Model Number and a Price column. There are also
          > two
          > more columns, each containing an HTML form:
          >
          > The first form is meant to Update my SQL database with the value entered
          > in
          > the Price field.
          > The second column is meant to Delete the record from my SQL database.
          >
          > The row is a repeat region to show all line items in the order.
          >
          > The Update form used to work just fine. However, having added the Delete
          > form
          > in the adjacent column, regardless of whether I submit the Update or
          > Delete
          > form, the record gets deleted. It seems that whichever Submit button I
          > click,
          > both forms get submitted. Is this normal?
          >
          > How do I stop this?
          >
          > Thanks!
          >

          • 2. Re: All forms on a page submit regardless of button clicked
            jimbo2k Level 1
            ** SOLVED **

            I had a fresh look at my code this morning, and noticed that the 'Delete' form and 'Update' form had a variable with a common name.

            This variable was quoted in both the Update and Delete server behaviours, hence why they both triggered.