Jump to content

Dynamic Form Elements w/PHP


gankoji

Recommended Posts

Hello Folks,

 

I hope this post won't be a duplicate or have any other annoyances to you seasoned members, but it's my first here so be gentle :). Anyhow, I have  a site which I'm developing that follows your basic PHP/HTML structure: HTML start, PHP to process form logic and access the DB, and the form itself. I'm trying to implement a button on the form that will allow users to add another input section (a group of input boxes) to the bottom of the form so that they can add more items to their query. I couldn't figure out how to do this in PHP, so I tried with Javascript. Got it to work for adding generic form elements, but the problem is this: The original form elements (which I essentially want to duplicate at the bottom of the form) are constructed by a PHP for loop on page load (they're <select> menus that are filled with entries from the DB). I can' figure out how I can get the same elements with the same data to load onto the page dynamically with new id's so they're unique.

 

Any guidance on this matter would be greatly appreciated. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/200598-dynamic-form-elements-wphp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.