Insertion Method in PHP ORM Architecture

Program 1

<?php 
 require 'dao.php';
  require 'model.php';
?> 

<html>
<body>
    <br><br><br><br><br><br><br><br><br><br>
    <center>
        <form method=post action="InsertStudent.php">
      <table border=1>  
        <tr>
            <th>Student Id</th>
            <td><input type=text name=txtid></td>
        </tr>
        <tr>
            <th>Name</th>
            <td><input type=text name=txtname></td>
        </tr>
        <tr>
            <th>Physics</th>
            <td><input type=text name=txtphy></td>
        </tr>
        <tr>
            <th>Chemistry</th>
            <td><input type=text name=txtchem></td>
        </tr>
        <tr>
            <th>Maths</th>
            <td><input type=text name=txtmath></td>
        </tr>
        <tr>
        <td></td>
        <td><input type=submit value=Submit name=btnSubmit></td>
        </tr>
</table> 
<?php 
   if(isset($_POST['btnSubmit']))
   {
             $id=$_POST['txtid'];
             $name=$_POST['txtname'];
             $phy=$_POST['txtphy'];
             $chem=$_POST['txtchem'];
            $math=$_POST['txtmath'];

           $S=new Student();
           $S->setrno($id);
           $S->setname($name);
            $S->setphy($phy);
            $S->setchem($chem);
            $S->setmath($math);

            $d=new StudentDAO();
            $d->insertStudent($S);

   }
?>
</center>
</body>
</html>

Program 2

<?php 
  require 'dao.php';
  require 'model.php';
?> 
<html><head><title>This is test page of connection</title></head>
<body>
<center>
<?php 
       
    //  $S=new Student();
    //  $S->setrno(1002);
    //  $S->setname('Nilesh');
    //  $S->setphy(96);
    //  $S->setchem(96);
    //  $S->setmath(96);

    //   $d=new StudentDAO();
    //   $d->insertStudent($S);
      
        // $sd=new StudentDAO();
        // $st=$sd->searchStudent(1003);
        // echo $st->getrno();
        // echo $st->getname();
        // echo $st->getphy();
        // echo $st->getchem();
        // echo $st->getmath();
    

?> 
</center>
<body>

 

courses
Image

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *