Hello, everyone. I need help with something, and I am hoping that someone could point me in the right direction. Since I am not sure what the technique is called, I will try to explain what I need to the best of my ability.

I am trying to create a plugin for an application. I need a form on the page to generate two separate things for me. The first part of the form will be used to create sections. When each section is created, it will appear below. Each section will correspond to a row in a particular database table (form_section). Below each section on that same page should be another form where I can create rows which are then editable. Each editable row show correspond to a row in a database table (form_section_row).

I really hope that I explained that well enough. I've been trying to wrap my head around how to achieve this. If you can point me to some resource on the web or some example/tutorial, that would be very helpful.

Recommended Answers

Sounds like you're trying to replicate phpmyadmin. A lot more info required. Are these sections (tables) linked? Any relationships?

I'm envisaging a dropdown with table names and an "add" button. When table selected and add button pressed, a section is created (table removed from dropdown) and a table of records …

Jump to Post

All 2 Replies

Member Avatar

Sounds like you're trying to replicate phpmyadmin. A lot more info required. Are these sections (tables) linked? Any relationships?

I'm envisaging a dropdown with table names and an "add" button. When table selected and add button pressed, a section is created (table removed from dropdown) and a table of records (possibly paginated) appears with edit and delete buttons in the last column. A "blank row" of form fields is included at the end of the table with an "add record button" in the last column. When record add pressed - ajax - validation, check entered into DB and return boolean - update html table (e.g. by scrolling to last record - the one just added - or navigate to paginated last page). "Edit button", changes tr tag to a form and td tags to fields. Edit/Delete buttons swapped to Add/Cancel.
"Delete button" swaps buttons to Confirm/Cancel.

Frameworks or vanilla MVC may be good for this. MVC would eat this up :)
Framework - only if already using one - bit of overkill to lever one just for this.

No, I am not trying to replicate phpmyadmin.

I want to have two forms on the same php page. The second form on that page will be hidden until there is at least one record in the form_section database table.

When one record is created, that data should be used to automatically populate table headers on the same php page. So, if there is only one row in form_section and it contains First Name, Last Name, Techology, Email and Address, then that information should be used to generate table headers where data will be entered into the form_section_row table (i.e. http://www.amitpatil.me/demos/add-edit-delete-rows-dynamically-using-jquery-and-php/with-drop-down/).

Therefore, when I open the php page, only one form will be shown if there is no data in the database table. When I fill out the form and then submit it, a table will automatically be generated with the table headers I just created and should look like the form in the link I posted above.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.