Retrieving table data for inclusion in a form
-
Hi,
I am so sorry to ask for a lot of help, but I am just starting out with coding and would love any aid you could offer.
I am working on my first plugin, one for keeping track of sports statistics for my school newspaper. I am up to the point of working on the parts which I had put off because I wasn’t sure how to do them, which is why I have so many questions. Right now, I am trying to work on the actual part where the user inputs statistics.
The idea would be that the user (editor) would input the name of a team and what year it is playing in, which would be enough information to find a table including all of the players and statistic types of the team. Then, potentially, a table would load to allow the user to input what amount of each statistic each player had in the game, hit a “submit” button, and send the data off to the table (which I have built already) for retrieval later.
The trouble is, I do not have enough expertise to know how to accomplish these steps. I’ll explain my problems step-by-step:
- User enters team name and year
- Team table is found, extracting players and statistics
- Statistic and player list is used to allow user to input data
- Data from statistics is sent to the SQL table
How should the data be sent off? Should I use an html form for getting the name and year? Something else? Once that data is sent, how can I have the page interact with the database? I’m afraid that I don’t know AJAX or javascript well enough to know what method to use.
I assume that this would be done with php and SQL/$wpdb, but how would the data be returned to the page and written?
Is it possible to create a table for the statistics and players in an html form? Should I use a dropdown menu and “add players” below somehow?
I think I know how to do this part. I would think that an html form sending data to a php file to add to the table would work, unless I am missing something.
Seeing as I am just starting up, I would love to hear any alternative ways of accomplishing any of this. To be clear, I have already written the code for creating team tables, adding both the player and statistic information to those tables in accessible ways using html forms, but if I absolutely need to, I could rewrite all of that code in a better way. Thank you so much for any help you can offer!
- The topic ‘Retrieving table data for inclusion in a form’ is closed to new replies.