September 3, 201115 yr 1. Do you prefer creating forms and scripts as 2 separate PHP files, such as signup_form.php and signup_script.php or do you just do it all in the 1 file? 2. When calling things like session_start(); or database connections, do you do them on each individual script and then close the connection at the end of the script, or do you call session_start and the db connections above the <html> tag on the page then write the individual scripts without them in. At the moment I am using separate form and script files and calling dbconnections and session_start in each script, I'm wondering if it would be more efficient to do it the other way.
September 3, 201115 yr 1) I find two separate files work best 2) Create a file that you can include that will do all your basic php startup such as db connection, any ini settings and start your session, then just include that with each page that needs it
September 3, 201115 yr Author So how I'm doing it is ok, no need to do it at the top of the page, just on the external script files
September 3, 201115 yr Yeah, just make sure your php include of the script is at the top of the form page before anything else
Create an account or sign in to comment