Q: i m unable to reference page based on the condition in if block public class insertnewrecordController{
 public task__c cds{get; set;}

        public insertnewrecordController(ApexPages.StandardController sr)
         {
         cds=   (task__c)sr.getRecord();
         }


public pagereference Save(){
list <id> i= new list <id>();
task__c cd = new task__c();
cd.Name=cds.name;
cd.Status__c=cds.Status__c;
cd.Review__c=cds.Review__c;
cd.Remark__c=cds.Remark__c;
i.add(cd.id);
insert cd;

if (t.status__c == 'close' )
{
Pagereference pg = new Pagereference('/apex/taskvf');
pg.setredirect(true);
return pg;
}
else
{
Pagereference pg1 = new Pagereference('/apex/tasf');
pg1.setredirect(true);
return pg1;
}}


A: You did not declare "t" prior to using it in if (t.status__c == 'close' ).
That is the error.  Seems like a typo and you should have written if (cds.status__c == 'close' ).   If the value of status__c is not present, then modify your constructor as follows:
public insertnewrecordController(ApexPages.StandardController sr)
         {
         sr.addFields(new List<String>{'Status__c'});
         cds=   (task__c)sr.getRecord();
         }

