0

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

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by nkmswot
0

Hi,

Split it on each as each menu index.

i.e :
students.php?m=add
students.php is student area index and the file access is add.php

It works i hope

0

can you explain what does add.php do? if I include everything about students in students.php what is add.php needed for? or is add.php a collection of functions for all the "add" operations in the site and students.php contains all the conditions and calls to that?
or you meant only the variable that contains the type of modification?
thank you.

0

No. its not a variable. Its the page link.

students.php is the page of Students index Page, It shows default page for student.
if anyone click on add menu its url is (student.php?m=add).it shows add.php file instead of default page in students.php

thanks,

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.