function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
renaiah anamalla 6renaiah anamalla 6 

I have getting error

apex code:

public class firstcon11 {
   public string name {get;set;}
   public String phone {get;set;}
   
  public  firstcon11(){
  
  }
    public pagereference save() {
      ABC__c a= New ABC__c();
      a.name=name;
      a.Phone__c= phone;
      insert a;
    PageReference demoPage = new PageReference(a);
   
     return demoPage;
    }
    }

Vfpage:

<apex:page controller="firstcon11">
  <apex:form>
  <Apex:pageBlock title="ABC details">
  Name:<apex:inputText/><br/><br/>
  Phone:<Apex:inputtext/><br/>
  <apex:commandButton value="save" action="{!save}"/>
  </Apex:pageBlock>
  </apex:form>
  </apex:page>


please share ur knowledge
@Karanraj@Karanraj
You have to set controller variable in the visualforce page 
<apex:page controller="firstcon11">
  <apex:form>
  <Apex:pageBlock title="ABC details">
  Name:<apex:inputText value={!name} /><br/><br/>
  Phone:<Apex:inputtext value={!phone} /><br/>
  <apex:commandButton value="save" action="{!save}"/>
  </Apex:pageBlock>
  </apex:form>
  </apex:page>

Check the Trailhead visualforce module for more details - https://developer.salesforce.com/trailhead/module/visualforce_fundamentals