Hi there,
I'm in the very early stages of making a new website which i have decided to do in OO PHP (as i have never used it in an OO way and know a bit of php so thought it would be good to experiment).
This question i'm about to ask could isn't an OO question as such but more a structure question.
If i have a register page complete with HTML form (or any page with a form and action), in your opinion where is it best to put the action?
I've seen some sites where the action is the page itself and the php code is contained within the top of the file i.e if $submit then register user else carry on and display page
And i've also seen some where the action would be on a totally different page that contained no html
e.g if you have a file called register.php then the action may be "actions/register_user.php"
I think for neatness sake i'd like to go for the latter and have the actions in a separate php file that way the code could be performed and then i could redirect the user to the sucess page or back to the register form highlighting errors.
The thing that puts me of doing this is having to use header ( ' Location:http://www.somesite.com/here.php') as the address in the users address bar remains the same as the page that did the redirect.
I hope this makes sense.
Thanks in advance for any help...
I'm in the very early stages of making a new website which i have decided to do in OO PHP (as i have never used it in an OO way and know a bit of php so thought it would be good to experiment).
This question i'm about to ask could isn't an OO question as such but more a structure question.
If i have a register page complete with HTML form (or any page with a form and action), in your opinion where is it best to put the action?
I've seen some sites where the action is the page itself and the php code is contained within the top of the file i.e if $submit then register user else carry on and display page
And i've also seen some where the action would be on a totally different page that contained no html
e.g if you have a file called register.php then the action may be "actions/register_user.php"
I think for neatness sake i'd like to go for the latter and have the actions in a separate php file that way the code could be performed and then i could redirect the user to the sucess page or back to the register form highlighting errors.
The thing that puts me of doing this is having to use header ( ' Location:http://www.somesite.com/here.php') as the address in the users address bar remains the same as the page that did the redirect.
I hope this makes sense.
Thanks in advance for any help...