I administrate a database with 3 main tables for a training company: course providers, lecturers and graduates.
I have to create a database admininstration page with insertion, modification and search features. I am using php with mysql.
I wanted everything to happen in the index.php (do not know if this is the best sollution) and created a couple of variables to determine the content display in the admin page. After clicking the "providers insertion page" it sets via GET insertion type to 0 (0-providers, 1-lecturers, 2-graduates) and then the user is given a form where he should write the number of entries he wants to insert, set via POST the insertion_count variable.
After this the user enters the information, submits, I set the variable "inserted" to 1 via input type="hidden", post. The next step is verification, the inserted data is fetched from the sql and the user is given the possibility to modify any entry. If it clicks on the modify button, it sends via hidden post the "modify_id" variable (the id from the sql table of the entry to be modified) and is now given the ability to correct the errors. He can accept the changes for this and then for all the entries and gets back to the home page.
The problem with this is that I have a big number of if's and navigation between the code's acollades becomes difficult as the page grows.
I'd have something like:
if isset($_POST['insertion_type']){
if isset($_POST['insertion_count']){
if isset($_POST['inserted']){
if isset($_POST['modify_id']){
if isset($_POST['finish']){...
}
else ...
}
else ...
}
else ...
}
else ...
}
Is there a way to make this better?
Thank you