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
Venkat Reddy 45Venkat Reddy 45 

Insert data from vf page to database:

Dear Experts,

        I want to Insert data from vf page to database and I wrote below code but I am getting error as " Unknown property 'fname' referenced in datainsert". Please send me code.

<apex:page>
<apex:form>
<apex:outputtext> First Name</apex:outputtext>
<apex:inputtext value="{!fname}"/>
<apexcommanButton value="submitt" action="{!save}"/>
</apex:form>
</apex:page>

Regards,
Venkat.
pconpcon
You need to have a controller on your Visualforce page that exposes the String fname and a method called save that returns a PageReference

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_custom.htm