Insert two forms with one submit

Hi!

I have two different mysql tables and and 2 forms for update.

I need to put one submit for update both records in two different tables.

Imagine I have one general data for client and the details are on other table, but in detailed view I show both information and I want update all info ate same time.

Just do it…

<?PHP
   if (submit-button#1) {
      handle #1's data...
   } elseif (submit-button#2) {
      handle #2's data...
  }
?>
<form ...>
   form #1...
   <submit #1...>
</form>
<form ...>
   form#2
   <submit #2...>
</form>

Not really complicated. I bet you are overthinking it. Just make sure that the names of the inputs for each form is unique so you can handle them in different PHP code areas…

No.

You just do your update with a join and you use a single form…

UPDATE T1,T2
INNER JOIN T2 ON T1.C1 = T2.C1
SET T1.C2 = T2.C2,
      T2.C3 = expr
WHERE condition

Yes, but, he didn’t show code, so was not sure and his other post showed it might be for a class…

Thank you for your help.

I Think I have to go to InnerJoin. Or I have other option. Is use the first submit as Next button and after show the second form .

There is yet another option just to put it out there. You can create a VIEW in the Database and just do a normal INSERT to the VIEW.

benamen.
could you explain better how to do it.

Sponsor our Newsletter | Privacy Policy | Terms of Service