Jump to content


Photo

Submit Multiple Forms At Once?


  • Please log in to reply
3 replies to this topic

#1 next

next

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 29 December 2012 - 07:33 PM

How do I submit forms in associative array format to PHP?
Here's what I have so far:
function submitSettings() {
    $('.forms').each(function() {
            $(this).serializeArray();
    });
}

looks like serialize creates assoc. array just like I need, but I don't understand how to pass the data to PHP. Can anyone help?

#2 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 29 December 2012 - 07:57 PM

Ajax!
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#3 Xaotique

Xaotique

    Advanced Member

  • Members
  • PipPipPip
  • 570 posts
  • LocationPennsylvania, United States
  • Age:22

Posted 29 December 2012 - 08:09 PM

$.post('page.php', $(this).serialize());

Remember if you're using a submit button to do it, you need to return false or else you'll follow it.

Edited by Xaotique, 29 December 2012 - 08:10 PM.


#4 next

next

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 29 December 2012 - 08:35 PM

Thanks. Now if I could only figure out how to get this to work in OpenCart :(




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com