Design questions
Posted: Sat Oct 20, 2012 12:48 pm
I'm a php amateur. I have a basic understanding of programming and have written really small programs in perl before (two separate scripts and a conf file), done a bunch of shell scripting, etc. I do them to solve admin problems or automate stuff I don't want to mess with any more.
I'm working on an application for internal use that will do selects (only) from a database. (FreeBSD, Apache22 and php5.4). I do not need to insert data, create or alter tables, etc. (In fact the user that will do the selects only has rights to do selects.) The database will contain rows of data representing timestamps, IP addresses, ports, protocols and connection state flags. The users should be able to search by src ip, dst ip, src prot, dest port, proto of flag states or combinations of those and for a single date or date and time or a range of dates or a range of dates and times.
So the queries would be something like this: select * from table where val=a, optional val=b, etc.
As I've been working on this I'm wondering if my design makes sense:
index.php - a page that displays whatever I want the user to see - it also includes a menu with links to an About page and a How To page
variables/variables.php - storage for commonly used globals
includes/search_functions.php - a common container for all the functions required to do the searches
includes/search_form.php - the form that allows the user to select the desired search parameters
includes/view_tables.php - a page that formats the return into a table for the returned data
Right now I'm including view_tables.php into the index page in the content div and it displays the table fine.
What I'm wondering how to do is to use index.php to display first the search form and then the view_tables page based on what action took place. IOW, when you first load the application, the index page would display the search form. When you click on submit, the index page would display the results of the search. Once the search results are returned, obviously there would have to be the ability to return to the form to do a second search etc.
Does this make sense? Or should the results be displayed on a separate page? What are the pros and cons of using the index page versus a separate results page?
I'm working on an application for internal use that will do selects (only) from a database. (FreeBSD, Apache22 and php5.4). I do not need to insert data, create or alter tables, etc. (In fact the user that will do the selects only has rights to do selects.) The database will contain rows of data representing timestamps, IP addresses, ports, protocols and connection state flags. The users should be able to search by src ip, dst ip, src prot, dest port, proto of flag states or combinations of those and for a single date or date and time or a range of dates or a range of dates and times.
So the queries would be something like this: select * from table where val=a, optional val=b, etc.
As I've been working on this I'm wondering if my design makes sense:
index.php - a page that displays whatever I want the user to see - it also includes a menu with links to an About page and a How To page
variables/variables.php - storage for commonly used globals
includes/search_functions.php - a common container for all the functions required to do the searches
includes/search_form.php - the form that allows the user to select the desired search parameters
includes/view_tables.php - a page that formats the return into a table for the returned data
Right now I'm including view_tables.php into the index page in the content div and it displays the table fine.
What I'm wondering how to do is to use index.php to display first the search form and then the view_tables page based on what action took place. IOW, when you first load the application, the index page would display the search form. When you click on submit, the index page would display the results of the search. Once the search results are returned, obviously there would have to be the ability to return to the form to do a second search etc.
Does this make sense? Or should the results be displayed on a separate page? What are the pros and cons of using the index page versus a separate results page?