0

I'm using a form to read the $_POST values

$s=new Student();
                $s->Name=$_POST['name'];
                $s->Email=$_POST['email'];
                $s->Education=$_POST['education'];
                $s->Save();

...


public function Save()
    {
        $conn = new PDO('mysql:host=localhost;dbname=week3', 'root', '');
        $statement = $conn->prepare("INSERT INTO user (name, email, education) VALUES (:name,:email,:education)");
        $statement->bindParam(':name', $this->Name);
        $statement->bindParam(':email', $this->Email);
        $statement->bindParam(':education', $this->Education);
        $statement->execute();


    }

I'm using getters and setters in the class student using a switch/case

Dharman
  • 30,962
  • 25
  • 85
  • 135

0 Answers0