aHMAD_SQaLli Posted October 27, 2015 Share Posted October 27, 2015 Hello sorry for the English if it's horrible so, I was wondering what is the best (fastest, secure) way to load a php script, is it to load the script in a function in the top and run it, or to execute each if ,else in the middle of the code. example 1 <?php function load_script(){ if (isset($_POST['query'])){ $php = $_POST['query']; # do things .... } else { # do things .... } # rest of the script ... } ?> <html> <head> <title></title> </head> <body> <?php load_script(); ?> </body> </html> example 2 <?php function load_script(){ if (isset($_POST['query'])){ $php = $_POST['query']; # do things .... } else { # do things .... } # rest of the script ... } ?> <html> <head> <title></title> </head> <body> <?php load_script(); ?> </body> </html> Thanks, Have a good day ! Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 27, 2015 Share Posted October 27, 2015 (edited) Yes at the top, but you dont need it to be a function. <?php if ($_POST) { //# do things .... } ?> <html> <head> <title></title> </head> <body> Page stuff </body> </html> Edited October 27, 2015 by benanamen 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.