Is it possible to write a method that redirects to another page and for that method to also return a variable to the call.
In the attempt below I am attempting to pass the variable $status back to the page being redirected to.
I know this could be accomplished with session variables. But I wondering if there is better solution.
Thanks in advance.
----------
function doAddStudent($data,$form) {
// create student data object
$student = new student();
$form->saveInto($student);
// check for matches
$dupe = DataObject::get('Student',
"`Lastname`='".Convert::raw2sql($student->Lastname)."'");
// && `FirstName`='".Convert::raw2sql($student->FirstName)."'"
// Debug::show($dupe);
if (!$dupe) {
$student->write();
$status='Record Saved';
$this->redirect('..');
}
else{
$status='Record not saved: Duplicate exists'
$this->redirectback();
}
}