This simply displays a table of all the data within a query.
So let say I wanted to select the third record from the table maybe I could add a button to edit each record for each row.
My question is, once the user clicks this button how does the program know which record to jump to.
Do I make a variable array where each time the while loop initiates it saves the row id into a variable called $contact[$i]? Or what other methods could I use because I have one big query, and then two sub queries on the same page to display data for each individual row of the first query.
(Kind of like a subform within a form like in MSAccess)
Another option is to add an edit button next to each user record in the html table.
The edit button has an onclick even handler which points to a url with a query string attached containing the userID (from the database) for that user.
The url points to a web page containing a form with inputs to edit the database table the original user data came from.
The inputs in the form are then updated as required and submitted to a server side script to update the database record for that userID.
You can achieve this only using PHP but it is going to make for a very static and unfriendly user experience. The best solution would be to use JavaScript in addition to PHP to support a persistent interface for modifying the data.
Lol yes I did know. It’s funny actually I am afraid of javascript because I don’t want to write code that can be altered to do things I don’t want it to do. And today our ad server (which uses javascript) just got hacked and is serving malware [don’t worry i am not deterred me from learning it]
@AnthonySterling by creative solutions, I guess I would say a modular design would be creative, nothing like calling a chunk of code repeatedly and getting different results based on results.
@oddz I was hoping to avoid javascript for now and make version 2.0 AJAX (after I learn it…) Javascript is not my forte
albeit though @Kalon solutions seems to be a good temporary solution, despite my anxiety about javascript.