Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:08:24+00:00 2026-06-07T09:08:24+00:00

I have advance search page with all the fields declared as search variables. I

  • 0

I have advance search page with all the fields declared as search variables.
I am holding all the variables in the session.

All i want to know is on click of submit the view page fields will be saved in to session variables. So on grid pagination and sort using the session variables it will load the data.

But i want to clear the session on click of the link for advance search page? How to do that?

Controller.php

public function actionAdvance_search()
    {
        $modelAdvSearchFinder = new AdvSearchFinder;
        print_r($_GET);
        if(isset($_POST) && isset($_POST['AdvSearchFinder']['submit']))
        {
            $this->clearAdvSearchSessionVar();

            Yii::app()->session['id'] = ( $_POST['AdvSearchFinder']['id'])? Yii::app()->session['id'] = $_POST['AdvSearchFinder']['id']:"";
            Yii::app()->session['name'] = ( $_POST['AdvSearchFinder']['name'])? Yii::app()->session['name'] = $_POST['AdvSearchFinder']['name']:"";
            Yii::app()->session['age'] = ( $_POST['AdvSearchFinder']['age'])?Yii::app()->session['age'] = $_POST['AdvSearchFinder']['age']:"";
            Yii::app()->session['class'] = ( $_POST['AdvSearchFinder']['class'])? Yii::app()->session['class'] = $_POST['AdvSearchFinder']['class']:"";
            Yii::app()->session['section'] = ( $_POST['AdvSearchFinder']['section'])? Yii::app()->session['section'] = $_POST['AdvSearchFinder']['section']:"";
            Yii::app()->session['Email'] = ( $_POST['AdvSearchFinder']['Email'])? Yii::app()->session['Email'] = $_POST['AdvSearchFinder']['Email']:"";
            $modelAdvSearchFinder->attributes = $_POST['AdvSearchFinder'];

        }
        $id = Yii::app()->session['id'];
        $name = Yii::app()->session['name'];       
        $age = Yii::app()->session['age'];
        $class = Yii::app()->session['class'];  
        $section = Yii::app()->session['section'];  
        $Email = Yii::app()->session['Email'];    

        $criteria=new CDbCriteria(array('distinct'=>true,));          
        $criteria->compare('id',$id,true);
        $criteria->compare('name',$name,true);
        $criteria->compare('age',$age,true);
        $criteria->compare('class',$class,true);
        $criteria->compare('sectionPerson',$section,true);  
        $criteria->compare('Email',$Email,true);

        if($id != "" || $name != "" || $age  != "" || $class   != "" || $section    != "" || $Email      != "" || $TelePhone1  != "" || $TelePhone2  != "" || $Fax  != "" || $Address     != "" || $State       != "" || $Suburb      != "" || $PostCode   != "" || $Include_inactive != "F")
        {   
            $modelSearch= new CActiveDataProvider("tblClass", array(
                'criteria'=>$criteria,
            )); 
        }
        else
        {
            $modelSearch = "";
            $this->clearAdvSearchSessionVar();
        }
       $this->render('advance_search',array('modelSearch' => $modelSearch,'modelAdvSearchFinder'=>$modelAdvSearchFinder));
    }

model.php

class AdvSearchFinder extends CFormModel
{

    public $id;
    public $name;
    public $age;
    public $class;
    public $section;
    public $Email;

    public function rules()
    {
        return array(
            array('id,name,age,class,section,Email', 'safe'),
        );
    }    
    public function attributeLabels()
    {
        return array(
            'id'=>'ID',
            'name'=>'Name',
            'age'=>'AGE',
            'class'=>'Class',
            'section'=>'section',
            'Email'=>'Email'
        );
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:08:27+00:00Added an answer on June 7, 2026 at 9:08 am

    Building on Orlymee’s answer, you can wrap this in a check in your controller:

    if(!Yii::app()->request->isAjaxRequest) { 
      unset(Yii::app()->session['var']);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an advanced search page that searches a number of fields in
first of all I'm using MySql. I have to create a advance search field
I have a search portal for school. And I am having one advance search
I have a search page that I'm implementing as part of an ASP.NET +
I have mod rewrite enabled to remove all page extentions.... This is done in
In my app I have an advanced search page which uses a tableview with
I have a site with a search box that works fine in all browsers
I'm using django-haystack for a search page on my site, and I want to
I have a search form on a previous page where I allow users to
I have an ASP.NET web page that has an advanced search tab. Within this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.