if ($form->isValid()) { // Perform success actions CRM_Utils_System::redirect('example.com/success-page'); }
if (!CRM_Core_Session::isLoggedIn()) { CRM_Utils_System::redirect('example.com/login'); }In both examples, the CRM_Utils_System redirect function is used to redirect the user to a specific URL based on a certain condition. This function is a part of the CiviCRM package library for PHP and is commonly used in CiviCRM projects.