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 9275899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:42:01+00:00 2026-06-18T16:42:01+00:00

I have a simple search public function search() { $criteria=new CDbCriteria; $criteria->with = array(‘agent’);

  • 0

I have a simple search

public function search() {
    $criteria=new CDbCriteria;
    $criteria->with = array('agent');

    $criteria->compare('full_name',$this->full_name,true);

    if ($this->gender_id != "") {
        $criteria->compare('gender_id',$this->gender_id);
    }

    return new CActiveDataProvider($this, array(
        'criteria'=>$criteria,
        'pagination'=>array(
            'pageSize'=>30,
        ),
    ));
}

But I don’t like that the search parameters appear in the address bar when you use the get method to search. I’ve changed my search widget to use the post method instead:

$form=$this->beginWidget('CActiveForm', array(
    'action'=>Yii::app()->createUrl($this->route),
    'method'=>'post',
));

But now when I hit the search button the page just refreshes instead of showing the search results, I assume I’m missing something here…

  • 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-18T16:42:02+00:00Added an answer on June 18, 2026 at 4:42 pm

    In your actionAdmin function of the controller replace $_GET by $_POST…

    if(isset($_GET['Model']))
        $model->attributes=$_GET['Model'];
    

    replace $_GET in above lines by $_POST like:

    if(isset($_POST['LoginLog']))
        $model->attributes=$_POST['LoginLog'];
    

    On a side note on search it is always advised to use GET instead of POST, the basic rule i use is whenever some data needs to be submitted it should be POST, whenever some data needs to be fetched it should be GET..

    Update:
    The main reasons I can think of i would use GET for search

    1) In searches user needs the functionality to back to previous filter, which if used as get url params, is straight forward.

    2) If the filter params are in url, its extremely easy to share results after certain filters..Imagine you want to share some results with a friend, would you give him instructions to filter step by step (In case of POST), or give a direct url(GET)

    3) Its very easy to change params from url, imagine currently you are visiting 2nd page, but on page while displaying filters only links to next 5 pages are displayed, but you want to jump to straight 15th page results..

    There will be many more advantages, I can think of these at the moment..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple script that does some search and replace. This is basically
I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
I have implemented a simple search function that highlights a row in a DataGrid
Ok, this is really really weird. I have the following simple regex search pattern
I have a simple search working in my rails app, but it only searches
I have a simple search box that it hidden until hover(over) and hides again
I have a simple search form with a box and a button. <form action
On my homepage I have a simple search form. The user can enter some
I have a simple rails search implemented in my app. At the time I
riting a very simple search using like and have an option to omit options,

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.