Required Fields

To set field as required, use set_required() method. If required fields are left blank, an “* required” message will be displayed. One more more fields can be specified as required fields in this method.

$dbForm = new C_DatabaseForm("SELECT * FROM Employees", "EmployeeID", "Employees");
$dbForm -> set_label("EmployeeID", "Employee ID");
$dbForm -> set_label("LastName", "Last Name");
$dbForm -> set_label("FirstName", "First Name");
$dbForm -> set_label("BirthDay", "DOB");
$dbForm -> set_hide("Extension");
$dbForm -> set_hide("hireDate");
$dbForm -> set_placeholder('Title', 'official job title');
$dbForm -> set_required(array("LastName"));
$dbForm -> display();

Sample output:


Live demo

No related content found.