JarrodCoder Posted May 30, 2013 Share Posted May 30, 2013 Hi guys, I'm trying to use the user input submitted and given to registerStageOne(). It's given by parameters in the function, then it returns the array. Here's the code: userCore.php class userCore { public $registerStageOne = array(); public $registerStageTwo = array(); public function registerStageTwo($d, $m, $y, $g) { require_once("cmsCore.php"); $registerStageOne = array($d, $m, $y, $g); return $registerStageOne; } public function registerStageThree($u, $e, $p, $rp) { if($p==$rp) { echo 'they match!'; $registerStageTwo = array($u, $e, $p, $rp); echo $registerStageTwo[1]; } else { echo 'Your Passwords do not match!'; } } } $userCore = new userCore(); register.php: <?php if(!isset($_GET['stage'])) { require_once($obj->getTPLDir() . "register-one.tpl"); } else { switch($_GET['stage']) { case "2": if(empty($_POST['bean_day']) || empty($_POST['bean_month']) || empty($_POST['bean_year'])) { echo 'you have not filled out the form.'; } $usersCore->registerStageTwo($_POST['bean_day'],$_POST['bean_month'],$_POST['bean_year'],$_POST['bean_gender']); require_once($obj->getTPLDir() . "register-two.tpl"); break; case "3": $usersCore->registerStageThree($_POST['bean.name'], $_POST['bean.email'], $_POST['bean.password'], $_POST['bean.retypedPassword']); // require_once($obj->getTPLDir() . "register-three.tpl"); break; } } ?> I want to take the data from $usersCore->registerStageTwo() and hold it (or pass it down to $usersCore->registerStageThree()) the reason I want it here is so that I can import it into the database at the end of stage three. Many thanks for your help. Quote Link to comment Share on other sites More sharing options...
gristoi Posted May 30, 2013 Share Posted May 30, 2013 i think you have a bit of a misguided view of what oop is. I advise taking a step back and reading a little more into the concepts of object orientation. I dont think me re writing you attemplt at a class will really benifit you Quote Link to comment Share on other sites More sharing options...
JarrodCoder Posted May 30, 2013 Author Share Posted May 30, 2013 Thanks for the response, so where exactly is my view misguided? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted May 30, 2013 Share Posted May 30, 2013 that's not really an object. You have basicly written procedural code and wrapped an object container around it, you could actualy take away the class{} from the outside of that code, drop the scope deffinitions and that would work just as it is in the raw page. Some key points to address - you have echo's within the methods within your object you never actually assign anything to your objects parameters you have a require within your object you have everything as public and - not specific to oop, but - you have a method named the same as a parameter 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.