Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of german gomez bajo  >  HTML form generator and submit  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example that shows a usage to add some comments into a page
Class: HTML form generator and submit
Generate HTML forms from a specification string
Author: By
Last change:
Date: 2010-10-26 09:01
Size: 979 bytes
 

Contents

Class file image Download
<?php
    
require_once("form.class.php");
    
    
$form=new Form;
    
$form->set_storage_file("storage.txt");
    
$form->set_action("");
    
$form->set_method("POST");
    
$form->set_id("my_form");
    
$form->set_class("css_style");
    
$form->setOptions("hidden:url:".$_SERVER['REQUEST_URI'].";*textfield:name;*textfield:email:your+email;textfield:website;*textarea:comment;textfield:referal:please");
    
$form->retrieve_html();
    if (isset(
$_POST['submit_form']))
        
$form->code_processor();
        
    
/*show comments*/
    
    
$file file_get_contents("storage.txt");
    
$exp explode("\n"$file);
    for (
$i 0$i count($exp); $i++) {
        
$exp2 explode(";"$exp[count($exp)-$i]);
        for (
$x 0$x count($exp2); $x++) {
            
//print $exp2[$x]."\n";
            
$exp3 explode(":"$exp2[$x]);
            if (
$exp3[0] == "url")
                if (
$exp3[1] != $_SERVER['REQUEST_URI'])
                    break;
            echo 
"<strong>".$exp3[0]."</strong><br />\n";
            echo 
str_replace("+"" "$exp3[1])."<br />\n";
        }
    }
?>