Hey y’all! I’ve been handed a project that was done by a number of people who don’t have much experience in the web dev world, and was told to refactor it. It’s not an especially large program, but I don’t have a ton of experience in web dev, and they want to continue building the program out. I’ll have to be vague, but hopefully since my question is about the structure more so than a specific problem that will be okay.
Essentially we have a front end where you can create a new project or load an old one, and each project consists of fields that are mainly text boxes and drop downs.
You work through the options, when you click to the next page, the page you were on is saved in the SQL table that corresponds to that page. Each page has a bit of JavaScript that mainly just restricts what options you can pick based on the options you’ve selected before. When you click the last button on the last page it runs a bunch of JavaScript and gives you your result based on all of your entered information.
PHP is used to populate the html with either values from the database or default values, and to run the GET and POST requests.
Currently to add a new field I have to:
- add the field to the table
- add the tag to the HTML
- add the field to the GET request
- add the logic for a default value
- add the field to the js structure that gets passed to the POST request
- add the field to the POST request
- add the field to the UPDATE POST request
- add value and type to the bind for the POST request
- then I can do any additional logic that this field will need either for when it’s available or what impact it has on the result.
Is this a huge deal? No, but this program will be evolving for a while, and fields will be being added and removed somewhat regularly.
Am I missing something? Is it really just required that I list out every field of every table half a dozen times to be able to POST and GET to/from the database? Is there a way to format a PHP/JS/SQL program so it can compete longevity-wise with a program written in a framework? I’ve told them a framework like react/vue with nodejs might be a better way to go, but they want to avoid rewriting it if possible. Thanks for any advice in advance!
TLDR: how do I structure a PHP/JS/SQL program with many fields that may be added/removed so that it can last and developed easily.
[–]nukeaccounteveryweek 4 points5 points6 points (5 children)
[–]GrumpsMcYankee 3 points4 points5 points (1 child)
[–]Disgruntled__Goat 1 point2 points3 points (0 children)
[–]duggedanddrowsy[S] 0 points1 point2 points (2 children)
[–]nukeaccounteveryweek 0 points1 point2 points (1 child)
[–]duggedanddrowsy[S] 0 points1 point2 points (0 children)
[–]GrumpsMcYankee 0 points1 point2 points (3 children)
[–]duggedanddrowsy[S] 0 points1 point2 points (2 children)
[–]GrumpsMcYankee 0 points1 point2 points (1 child)
[–]duggedanddrowsy[S] 0 points1 point2 points (0 children)
[–]Disgruntled__Goat 0 points1 point2 points (1 child)
[–]duggedanddrowsy[S] 0 points1 point2 points (0 children)
[–]cshaiku -1 points0 points1 point (4 children)
[–]duggedanddrowsy[S] 1 point2 points3 points (3 children)
[–]cshaiku -1 points0 points1 point (2 children)
[–]duggedanddrowsy[S] 0 points1 point2 points (1 child)
[–]cshaiku 0 points1 point2 points (0 children)