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 Edwin F. Sturt  >  JavaScript in PHP  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: JavaScript in PHP
Generate JavaScript for validation of HTML forms
Author: By
Last change:
Date: 2011-11-17 12:34
Size: 4,959 bytes
 

Contents

Class file image Download
<?
/*
Dependencies start
*/
$PATH "./";

include 
$PATH.'Error_handler.php';
include 
$PATH.'class_form.php';
include 
$PATH.'class_validate.php';
// Dependencies end

// Declaring Object starts
   
    
$validate_form = new form_validation();
// Declaring Object Ends  

      
    // To Display Html head Section
    
page_head("PHP Javascript Simple Validation Example");
    
               
// To Link Style Sheet
                // Example _link_stylesheet("PATH OF YOUR CSS","TYPE OF CSS");
    
                
_link_stylesheet("style.css","text/css");
                
_link_stylesheet("table.css","text/css");
                
                
// Javascript Start Here
                    
$validate_form->js(1);
                    
$validate_form->is_number();
                                
                                
$validate_form->js_function_start("validate");
                                
                                    
$validate_form->form_validate("example","fname","Fisrt Name Please");
                                    
$validate_form->form_validate("example","mobile","Mobile Number");
                                    
$validate_form->check_number("example","mobile","Enter Number Only"); 
                                    
$validate_form->form_validate("example","email","Enter email");        
                                    
$validate_form->validate_email("example","email");
                                              
                      
                                
$validate_form->js_function_end();
                                
                                
$validate_form->js_function_start("validate2");
                                
$validate_form->form_validate("example2","User","User Name");
                                
$validate_form->Password_validate("example2","Pwd1","Pwd2",10);
                                
$validate_form->js_function_end();
                                
                    
$validate_form->js(0);
                
// Javascript Ends Here
    // Create document Background color, Text Color, Font size etc..
    
body_elements("orange","Verdana, Arial, sans-serif","12px","white","bold");
    
 
            
            
// Create Table and form elements Here
            
start_form("example","post","","",JS6,"return validate();");
                    
new_table("50%",1,3,3,"left");
                    
// Example if value 1 then open <tr> if 0 then closing </tr> tags $display_form->row(1);
                            
row(1);
                                
label("Example Form One 1",2,"450px","red","16px","center");
                            
row(0);
                            
row(1);
                                
label("First Name",1,"","","10px","left") . input(T,"fname");
                            
row(0);
                            
row(1);                                
                                
label("Mobile Number",1,"","","10px","left") . input(T,"mobile");
                            
row(0);
                            
row(1);                                
                                
label("Email",1,"","","10px","left") . input(T,"email");
                            
row(0);
                            
row(1);                                
                                
label("Process Here",1,"","","10px","left") . input(S,"Submit","Submit","");
                            
row(0);
                   
table_end();
            
end_form();
            
// form elements End
        
                    
start_form("example2","post","","",JS6,"return validate2();");
                    
new_table("50%",1,3,3,"left");
                    
// Example if value 1 then open <tr> if 0 then closing </tr> tags $display_form->row(1);
                            
row(1);
                                
label("Example Form One 2",2,"450px","red","16px","center");
                            
row(0);
                            
row(1);
                                
label("Username",1,"","","10px","left") . input(T,"User");
                            
row(0);
                            
row(1);                                
                                
label("Password",1,"","","10px","left") . input(P,"Pwd1");
                            
row(0);
                            
row(1);                                
                                
label("Re-Enter Password",1,"","","10px","left") . input(P,"Pwd2");
                            
row(0);
                             
row(1);                                
                                
label("Process Here",1,"","","10px","left") . input(S,"Submit","Submit");
                            
row(0);
                   
table_end();
            
end_form();
        
        
    
// To Close Nessesscary HTML End Tags
    
end_page();        

?>