<?php
class Student{
private $fullname;
private $mobile;
function setFullName($val){
$this->fullname = $val;
}
function setMobile($val){
$this->mobile = $val;
}
function getFullName(){
return $this->fullname;
}
function getMobile(){
return $this->mobile;
}
function myprint(){
echo $this->getFullName();
echo $this->getMobile();
}
}
if(isset($_POST['btnSubmit'])){
$obj = new Student();
$obj->setFullName($_POST['fullname']);
$obj->setMobile($_POST['mobile']);
$obj->myprint();
}
?>
<form method="post" action="">
<input name="fullname">
<input type="mobile" name="mobile"/>
<input type="submit" name="btnSubmit"/>
</form>
class Student{
private $fullname;
private $mobile;
function setFullName($val){
$this->fullname = $val;
}
function setMobile($val){
$this->mobile = $val;
}
function getFullName(){
return $this->fullname;
}
function getMobile(){
return $this->mobile;
}
function myprint(){
echo $this->getFullName();
echo $this->getMobile();
}
}
if(isset($_POST['btnSubmit'])){
$obj = new Student();
$obj->setFullName($_POST['fullname']);
$obj->setMobile($_POST['mobile']);
$obj->myprint();
}
?>
<form method="post" action="">
<input name="fullname">
<input type="mobile" name="mobile"/>
<input type="submit" name="btnSubmit"/>
</form>
0 comments:
Post a Comment