gankoji Posted May 3, 2010 Share Posted May 3, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/200598-dynamic-form-elements-wphp/ Share on other sites More sharing options...
Muddy_Funster Posted May 3, 2010 Share Posted May 3, 2010 You could try loading everything that you want on the page at the start, and then hiding the bottom stuff untill the button is clicked to reveal it. That way everything is being pre-populated from the php and there should be no problems. Quote Link to comment https://forums.phpfreaks.com/topic/200598-dynamic-form-elements-wphp/#findComment-1052644 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.