Monday, January 20, 2014

PHP with OOPS

here you have to construct two PHP files 

----------------------------------------------------------------------------------------------

 index.php

<?php
include("connection.php");
$obj=new apoo;
if(isset($_POST['SUB']))
{
   
    $un=$_POST['uname'];
    $up=$_POST['upass'];
   
    $yyy=$obj->AddUss($un,$up);
    }
//header("location:registration.php");
    ?>

<html>
<body>
<form method="post" action="">
username
<input type="text" name="uname" />
password

<input type="text" name="upass" />

<input type="submit" name="SUB" />

</form>
</body>
</html>


--------------------------------------------------------------------------------------------------------

connection.php


<?php

session_start();
class CLASSNAME
{
    var $connect;
    function __construct()
    {
        $this->connect=new MySQLi("localhost","root","","sun12k");
        echo "success";
    }
  
    function AddUss($un,$up)
    {
        $addU=$this->connect->prepare("insert into`nametable`(firstname,lastname)VALUES(?,?);");
        $addU->bind_param("ss",$un,$up);
        $addU->execute();
    echo "success2";
       
        //    header("location:home.php");       
        }
}
?>

1 comment:

  1. My friend Suggest me this blog and I can say this is the best blog to get the basic knowledge.Thank you so much for this Selenium Training in Chennai

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...