tags:

views:

36

answers:

2

how to manage a process php file?? i want every form which connected to database just use one php file..how to separate every command inside that php file??can i do that?

+3  A: 

The easiest way is to have a hidden variable in each form. In the PHP processing page, you check for that variable, perhaps in a switch statement and do the appropriate code there.

That being said, I don't recommend this method. It makes you add extra data and it makes the processing more complicated and confusing. I suggest having each page post to itself and operate off data there.

Kerry
u mean that every form have one php processing file,aren't u?
klox
That's what you asked, right? My recommendation is having every form submit to itself. The form is in a php file and so is the processing.
Kerry
A: 

Use a GET parameter (i.e. a querystring in the action) or a hidden input to specify which form has been submitted.

Ignacio Vazquez-Abrams
Kerry said that it's so complicated and don't agree with my suggestion..is that true?
klox
Of course it's complicated. But that's between you and whoever has to maintain your code after you, and the knife they hold in their hand as they hunt you down and kill you.
Ignacio Vazquez-Abrams
ahaha..how terrible they are..i'll try another way..
klox