Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class box{
- function displaybox(){
- ?>
- <div class="box">
- <?php
- }
- }
- class CLbox extends box{
- function closebox(){
- ?>
- </div>
- <?php
- }
- }
- class form{
- var $fields = array();
- var $totFields = 0;
- var $thisname="default";
- function __construct(){
- $this->asend = "send.php";
- $this->amethod = "post";
- }
- function change_form($thisname,$thisaction,$thisMethod){
- $this->asend = $thisaction;
- $this->amethod = $thisMethod;
- $this->thisname = $thisname;
- }
- function displayform(){
- ?>
- <form action="<?php print $this->asend;?>" name="<?php print $this->thisname;?>" method="<?php print $this->amethod;?>">
- <?php
- for($op=0; $op<count($this->fields);$op++){
- ?>
- <label><?php print $this->fields[$op]['labelField'];?></label>
- <input type="<?php print $this->fields[$op]['typeField'];?>" name="<?php print $this->fields[$op]['nameField'];?>"/>
- <?php
- }
- }
- function addField($typeField,$nameField,$labelField){
- $this->fields[$this->totFields]['typeField']=$typeField;
- $this->fields[$this->totFields]['nameField']=$nameField;
- $this->fields[$this->totFields]['labelField']=$labelField;
- $this->totFields++;
- }
- }
- class createButton extends form{
- function showButton($typeButton,$valButton){
- $this->valB=$valButton;
- $this->typeB=$typeButton;
- ?>
- <input type="<?php print $this->typeB;?>" name="nama" value="<?php print $this->valB;?>"/>
- <?php
- }
- }
- class closeF extends form{
- function closeform(){
- ?>
- </form>
- <?php
- }
- }
- $createbox = new box();
- $showForm = new form();
- $clsBox = new CLbox();
- $cls = new closeF;
- $BTton = new createButton;
- ?>
- <html>
- <body>
- <?php
- $acc=$_SERVER["PHP_SELF"];
- $createbox->displaybox();
- $showForm->change_form("nameform","$acc","post");
- $showForm ->addField("text","name","label");
- $showForm ->addField("radio","name","radio");
- $showForm->displayform();
- $BTton->showButton("submit","new");
- $BTton->showButton("reset","reset");
- $cls->closeform();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment