Add to array, redirect and display

by polyman   Last Updated March 28, 2019 20:08 PM

I want add text to array and display after redirect and unset array.

        public function save($type, $value){

        global $tab;

        $tab[] = array('type' => $type, 'value' => $value); 

        }


        public function display(){

        global $tab;

        if (!empty($tab)){

            foreach (){ 

            echo ....

            }

         $tab = array();


        }

     } 


class test{


public function one(){

$this->save(2, 'some');

 $url = get_site_url(null, '/redirect_to_two');
 wp_safe_redirect( $url );

}


public function two(){

$this->display();

}



}

I have no value, nothing.

Did i must use sessions? This is only for messages, notices like succes register.



Related Questions


Updated February 27, 2016 01:03 AM

Updated December 18, 2016 08:03 AM

Updated April 13, 2015 20:03 PM