Adding code for View/Edit of existing...

User 2202726 Photo


Registered User
12 posts

I like the speed and ease of creation, and the look of forms created in WFB so would like to use it to create the basic input forms I am needing for a website project.

However, after I've created a WFB form that adds submission data to a MySql database, I need to edit/alter the files WFB generates to allow the user to also have the ability to select, then view, edit and update records already existing in the MySQL database table. These would be records they specifically have created, so would be linked to a database field containing a unique ID for that user, and queried based on that ID. When the record is loaded, I wish to load it into a form with the same basic 'look and feel' as the original submission form I've created in WFB.

I need guidance on accomplishing this, including where to place additional php code, and also examples (if available). While not new to database programming and software design, I'm very new to the web based equivalent and am studying like mad :) to update my skill set in this area.

Thanks for any tips/tricks and examples -

Annette

User 187934 Photo


Senior Advisor
20,190 posts

On your formname.html add the mysql query looking up all the data based on the ID of the user.
Use the mysql query to set all the variables then echo them out as values in your actual form or a copy of it.
To have the ability to submit the data and update you'll need to write your own myformname.php to handle it.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2202726 Photo


Registered User
12 posts

Thanks for the response, Eric -

Yes, I understand that I would need to place a SQL query in the main HTML submit form created by WFB, add or edit PHP files, etc. in order to alter or replicate/alter the form in a way that will allow a full CRUD function.

When I look at the code generated by WFB, there are multiple files, multiple folders, that are all called into action to style and format the form. Without going through more time consuming dissection, which I was hoping to avoid, I'm not sure at this point which files are safe to change or replace, and which I must retain in order to maintain the function of the input form itself. For instance, if I replace my entire myformname.php file with custom php, I lose the call to the config.inc.php, various arrays, etc. If there are key essential pieces of that php file I must retain, I'm not sure what they are. If I alter/edit other php files generated by WFB, I'm also not certain how that will affect the code WFB suggests be included in my web page at the point I wish to embed the form, since that bit of code also references both the HTML and the myformname.php code, and I'm unclear of what ripple affect might occur.

Since I lack complete documentation letting me know the purpose and function of each file and folder created by WFB, I was hoping to get some tips and tricks from any WFB users who are currently editing their forms to allow create replace, update, delete. If I only need to make changes in a handful of places, that seems easy enough to do. If however, I would need to change information in multiple folders and php files, I'm not sure it is worth my tackling the project from this angle.

Annette
User 187934 Photo


Senior Advisor
20,190 posts

Have you given any thought to have separate forms for each task?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2202726 Photo


Registered User
12 posts

Hi Eric - I had thought to create a copy of each basic 'submit' form, then modify one copy for edit, one for delete, etc. My project deadline looms, however, so due to lack of examples, samples, on turning a set of basic WFB submit form into something that could function as a full CRUD, I've decided to use a different tool. This topic is still something I'd like to explore further later, but no more time to do it now.

I'm used to visualizing and designing databases, along with the accompanying user interfaces, for client/server applications -- and knowing exactly how to use the tools to do that. As I move into web based database design, and learn a different toolset to accomplish what I'm after, the initial learning curve is getting in the way of my productivity, :).

Annette

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.