plz help me to create a code in PHP
the INSERT operation is used with a Class which inserts data and go into the database.

What do you have so far?

What's your question? What have you achieved with the task so far? What are you stuck on?

i want to insert the data through class in database in php

Yes, you already said. Show YOUR code so far.

**

customer.php

**

<?php

class Customer
{
    private $first_name;
    private $last_name;
    private $age;

    public function __construct()
    {
        $first_name = "";
        $last_name = "";
        $age = 0;
    }

    public function setdata($first_name, $last_name, $age)
    {
       $this -> first_name = $first_name;
       $this -> last_name = $last_name;
       $this -> age = $age; 
    }

    public function printdata()
    {
        echo "Name :" . $this -> first_name. "" . $this -> last_name;  
        echo "Age :" . $this -> age;
    }

}

  $c1 = new Customer();
  $c1 -> setdata("","","");
  $c1 -> printdata();
  $c2 = new Customer();
  $c2 -> setdata("","","");
  $c2 -> printdata();
  $c3 = new Customer();
  $c3 -> printdata();

?>  

**

index.php

**

<html>
<body>
<?php
if(isset($_GET['submit']))
{
    echo "Name" . $_GET['first_name'] . $_GET['last_name'] . "<br/>";
    echo "Age" . $_GET['age'] . "<br/>";
}
?>
<form enctype="multipart/form-data" action="entry.php" method="get">
First Name : <input type="text" name="first_name" /> <br />
Last Name : <input type="text" name="last_name" /> <br /> 
Age : <input type="text" name="age" size="27" /> <br/>
<input type="submit" value="Insert" name="submit" />
</form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.