General PHP Program Flow Control
Posted: Mon Aug 11, 2003 3:23 pm
Hello all,
I have been programming with PHP for a while now, but nothing too outrageously advanced... However, I am working on a medium sized database front-end now, and thought I'd ask other developers a question or two...
Right now I use hidden form tags to control the flow of my programs... But it's getting sort of messy... Basically I set hidden fields with certain values, and use a structure like this:
This works fine on small projects... And I'm sure there are developers here that will say that it works fine for large projects too...
But I just cant seem to keep track of it mentally once it goes more than a majorfunction/minorfunction in... I'm to the point where I am using major/middle/minor functions...
I have considered several other alternatives:
1) Continue to use the hidden form fields to control flow
2) Use cookies, which I view as sort of a messy solution
3) Use PHP sessions and keep the major/minor function variables
on the server side which still leaves me with basically the same
structure, but just storing the variable values on the server side.
Does anyone have an elegant solution that they would recommend to a programmer who hasnt done many major projects?
Thanks,
Brad
I have been programming with PHP for a while now, but nothing too outrageously advanced... However, I am working on a medium sized database front-end now, and thought I'd ask other developers a question or two...
Right now I use hidden form tags to control the flow of my programs... But it's getting sort of messy... Basically I set hidden fields with certain values, and use a structure like this:
Code: Select all
if (empty($get_majorfunction)) {
// No function chosen
} elseif ($get_majorfunction == "view") {
if (empty($get_minorfunction)) {
// View majorfunction, but no minor function
} elseif ($get_minorfunction == "select") {
// Display a form to select account to view
} elseif ($get_minorfunction == "submit") {
// User supposedly selected acct, submit the info
}
}But I just cant seem to keep track of it mentally once it goes more than a majorfunction/minorfunction in... I'm to the point where I am using major/middle/minor functions...
I have considered several other alternatives:
1) Continue to use the hidden form fields to control flow
2) Use cookies, which I view as sort of a messy solution
3) Use PHP sessions and keep the major/minor function variables
on the server side which still leaves me with basically the same
structure, but just storing the variable values on the server side.
Does anyone have an elegant solution that they would recommend to a programmer who hasnt done many major projects?
Thanks,
Brad