Can you help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
Nice to know all master php...

Can someone help me about php class?maybe a sample code or book or anything
hehehe :)

I was learning php class but I have a little bit problem when I implemented
it into the programme, Im already understand a little bit about the class
php concept about constructor, interface, interhace, etc..
but how can php class join with the form??? I mean is if we use class php
how can we translate textbox, button?It make with class too?or make manual
as usual with html??Im really confuse with submit button and how to
configure it (php class) with ajax, etc...

I'm recently use php code with ajax but never using class before....

this is what I already make : is it true??.. Thanks for your help ^^

********************************
*<?php
class formelement
{
    var $f_title;
    var $f_name;
    var $f_value;
    public function set_textbox($title,$name,$value)
    {
        $this->f_title = $title;
        $this->f_name = $name;
        $this->f_value = $value;
    }
    public function get_textbox()
    {
        //Format Standard 3 baris form
        echo "<tr><td>".$this->f_title."</td><td>:</td><td><input
type='text' name='".$this->f_name."'"."
value='".$this->f_value."'/></td></tr>";
    }
    public function set_textpwd($title,$name,$value)
    {
        $this->f_title = $title;
        $this->f_name = $name;
        $this->f_value = $value;
    }
    public function get_textpwd()
    {
        //Format Standard 3 baris form
        echo "<tr><td>".$this->f_title."</td><td>:</td><td><input
type='password' name='".$this->f_name."'"." value='".$this->f_value."'
class='tx'/></td></tr>";
    }
    public function set_button($name,$value)
    {
        $this->f_name = $name;
        $this->f_value = $value;
    }
    public function get_button()
    {
        //Format Standard 3 baris form
        echo "<tr><td></td><td>:</td><td><input type='button'
name='".$this->f_name."'"." value='".$this->f_value."'/></td></tr>";
    }
}

?>*
********************************
*<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="css/css_formelement.css" />
</head>
<body>

 include_once ('class/cl_user.php');

<table border="1" cellpadding="0" cellspacing="0">
<?php
$contact_form = new formelement();
$contact_form->set_textbox("Name","Coba","Coba Tombol");
$contact_form->get_textbox();
$contact_form->set_textbox("Address","Coba","Coba Tombol");
$contact_form->get_textbox();
$contact_form->set_textbox("Email","Coba","Coba Tombol");
$contact_form->get_textbox();
$contact_form->set_textbox("Description","Coba","Coba Tombol");
$contact_form->get_textbox();
$contact_form->set_textpwd("Password","Coba","Coba Tombol");
$contact_form->get_textpwd();
$contact_form->set_button("Save","Coba Tombol");
$contact_form->get_button();
?>
</table>


</body>*
*</html>*
********************************

-- 

Best Regards,


*Evlin Marcelline F, S.Kom*


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux