Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

Blogs


Object oriented php class simple example

<?php

class Name

{

    public $name;

    public function showName()

    {

        /**

        Put your database code here to extract from database.

        **/

        return($this->name);

    }

    public function enterName($TName)

    {

        this->$name = $TName;

        /**

        Put your database code here.

        **/

    }

}

?>

 

In checking.php you can include:

 

<?php

    include_once("name_class.php");

    $name = $_POST['name'];   //add name attribute to input tag in HTML

    $myName = new Name();

    $myName->enterName($name); //to save in database/

    $name=$myName->showName(); //to retrieve from database. 

?>

 

This way you can achieve this, this is just an overview. It is much more than that.



Your comment