Trium918 Posted April 8, 2007 Share Posted April 8, 2007 Building User Authentication and Personalization In this case I have multiple forms where the user will have to enter data. I was wonder since register_global =Off what would a good idea to initialize all variables associate with each script. Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/ Share on other sites More sharing options...
Trium918 Posted April 8, 2007 Author Share Posted April 8, 2007 Should I do something like this. <? // data_valid_fns.php // I can include this file in all my files // this way, every file will contain all my functions require_once("initialize_variables.php"); ?> <? // data_vaild_fns.php require_once("data_valid_fns.php"); username = $_POST['username']; passwd = $_POST['passwd']; passwd2 = $_POST['passwd']; email = $_POST['email']; ?> Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/#findComment-224534 Share on other sites More sharing options...
clown[NOR] Posted April 8, 2007 Share Posted April 8, 2007 you dont have to split the require_once() into 2 diff php tags tho and you should use $ infront of the variables =) but i guess u allready know that... just wanted to point it out just in case Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/#findComment-224539 Share on other sites More sharing options...
Trium918 Posted April 8, 2007 Author Share Posted April 8, 2007 link=topic=135149.msg569612#msg569612 date=1176072802] you dont have to split the require_once() into 2 diff php tags tho and you should use $ infront of the variables =) but i guess u allready know that... just wanted to point it out just in case require_once is in two different files not tags. require_once("data_valid_fns.php"); would be the main file that connects every variable to all of the other files. Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/#findComment-224551 Share on other sites More sharing options...
Trium918 Posted April 9, 2007 Author Share Posted April 9, 2007 Would it be a good idea to do it this way? Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/#findComment-224579 Share on other sites More sharing options...
Trium918 Posted April 9, 2007 Author Share Posted April 9, 2007 Is it safe to initialize variables like this? Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/#findComment-225190 Share on other sites More sharing options...
per1os Posted April 9, 2007 Share Posted April 9, 2007 Nothing wrong with it all as long as you do initialize them. Link to comment https://forums.phpfreaks.com/topic/46185-initializing-variables/#findComment-225221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.