bradgrafelman;10982708 wrote:I'm a bit confused by what you're calling a "page" - can you define that term?
You could have an HTML form submit its data to a PHP script that in turn calls a thousand other PHP scripts. They aren't "pages" - they're simply other files that are used together to service the incoming request.
Sorry for the confusion.
Here is what I mean by a page... All my "pages" are php, in other words there extension end in .php not .html but they display content in html format. So with that being said....
I have a page named profile.php it displays information from about a user in html format and that information comes from a mysql database, no information can be changed about the user from the profile.php page, so forget this page for a moment. Now on another page I have called settings.php any and all information can be changed about the user, it has html form fields that a user can enter data then submit (by a button) that will change a user's information in the mysql database. The question is, should I use a seperate .php page to process the mysql information from the settings.php page and then have it redirect back to the settings.php page or should I use the settings.php page its self to do both, A: allow the user to enter values in the form fields, and B: process the info from the form fields into the mysql database
Now just like the settings.php page, I have other pages with form fields where the user can enter values as well, the same question applies to these pages, or should I just use only ONE .php page to process ALL information from all html forms on the .php pages and have it all processed into the mysql database by sending variables in the form's action link. i.e.
settings.php Page
<form name="frm1" method="post" action="process.php?do_action=change_user_info">
page1.php Page
<form name="frm2" method="post" action="process.php?do_action=change_some_info1">
page2.php Page
<form name="frm3" method="post" action="process.php?do_action=change_some_info2">
page3.php Page
<form name="frm3" method="post" action="process.php?do_action=change_some_info3">
page4.php Page
<form name="frm4" method="post" action="process.php?do_action=change_some_info4">
process.php Page
$do_action = $_POST['do_action'];
if($do_action == "change_user_info"){
//Do some database processing code here
//as well as other php code
}elseif($do_action == "change_some_info1"){
//Do some database processing code here
//as well as other php code
}elseif($do_action == "change_some_info2"){
//Do some database processing code here
//as well as other php code
}elseif($do_action == "change_some_info3"){
//Do some database processing code here
//as well as other php code
}elseif($do_action == "change_some_info4"){
//Do some database processing code here
//as well as other php code
}
I hope this helps clear things up?
So your opinions please?