Yohanne Posted July 10, 2013 Share Posted July 10, 2013 i need to login but first here is my code. Class_login.php class Class_login { public function get_post() { $Message = array(); if(empty($_POST['VAR1'])) { $Message = 'Please fill-in required field'; } else { $_POST['VAR1'] = mysql_real_escape_string($_POST['VAR1']); } if(sizeof($Message) > 0) { $array_lenght = count($Message); for($i = 0; $i < $array_lenght; $i++) { echo $Message[$i]; echo "</br>"; } } else { header('Location:saa.php'); } return false } } login.php <?php function __autoload($classname) { $filename = "./../Class/". $classname .".php"; include_once($filename); } $newClass = new Class_login(); public function actionLogin() { if(isset($_POST['submit']) && 'Login' == $_POST['submit']) { ????#########? } else { false; } } ?> now, how do i call the function "get_post" from Class_login, and i want it to use inside the login.php. Thanks Quote Link to comment Share on other sites More sharing options...
denno020 Posted July 10, 2013 Share Posted July 10, 2013 Pretty straight forward to call the function: $classLogin = new Class_login(); $classLogin->getpost(); Also make sure that you actually include the Class_login.php file, otherwise PHP won't know where Class_login is defined. Denno Quote Link to comment Share on other sites More sharing options...
Yohanne Posted July 10, 2013 Author Share Posted July 10, 2013 Thanks for your reply, and in this case i use __autoload function. i think it is same function into include. Quote Link to comment Share on other sites More sharing options...
denno020 Posted July 10, 2013 Share Posted July 10, 2013 If you've got an autoloader, then you'll probably need to include the namespace so that the autoloader knows which file to include? That's how I've got mine set up.. An autoloader includes files depending on what use statements are at the top of file. 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.