Location: PHPKode > scripts > Ajax Registration Module > index.php
<?php
/**
 * Ajax Registration Module v1.1
 *
 * Ajax Registration Module is a simple AJAX registration page with ajax validation and easy to 
 * plug into your existing php application.
 *
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2009, Christopher M. Natan
 * @link          http://phpstring.co.cc/phpclasses/modules/ajax-registration-module/
 * @version       $Revision$
 * @modifiedby    $LastChangedBy$
 * @lastmodified  $Date$
 */
 
/**
 * FORM VALIDATION Reserved words:
   
   validate_blank  -   i.e  <input name="fname" type="text" class="validate_blank"/>
   validate_email  
   validate_username
   validate_password
   validate_password_confirm
   validate_agree
   
 
 */
 
   include('ajaxRegistrationModule.class.php');
   $ajaxRegistrationModule = new ajaxRegistrationModule;
?>
<!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>Ajax Registration Module v1.1</title>
<link href="files/register.css" rel="stylesheet" type="text/css" />
<?php echo $ajaxRegistrationModule->initScript();?>
</head>
<body>
<div id="container" style="display:none" >
  <div class="title">Ajax Registration Module v1.1</div>
  <div class="ajax_notify"> 
    <img src="files/error.jpg" /> Error : Please complete this registration form.
    <!--don't delete this div class="ajax_notify"-->
  </div>
  <form action="" method="post" class="ajax_form">
    <ul>
      <li class="label"> Email Address <span class="desc"> should valid email address</span> </li>
      <li class="field">
        <input name="email" type="text" class="validate_email text" id="email" />
      </li>
      <li class="label"> Username <span class="desc"> minimum of 6 characters long</span> </li>
      <li class="field">
        <input name="username" type="text" class="validate_username text"/>
      </li>
      <li class="label"> Password <span class="desc"> minimum of 6 characters long</span> </li>
      <li class="field">
        <input name="password" type="password" class="validate_password text"/>
      </li>
      <li class="label"> Confirm Password <span class="desc"> please re-type your password</span> </li>
      <li class="field" style=" margin-bottom:35px">
        <input name="password" type="password" class="validate_password_confirm text"/>
      </li>
      <li class="label"> First name <span class="desc"> required</span> </li>
      <li class="field">
        <input name="fname" type="text" class="validate_blank text"/>
      </li>
      <li class="label"> Last name <span class="desc"> required</span> </li>
      <li class="field">
        <input name="lname" type="text" class="validate_blank text"/>
      </li>
      <li class="label"> Gender <span class="desc"> required</span> </li>
      <li class="field">
        <select name="gender" class="validate_blank combo">
          <option value="0">Please Select</option>
          <option value="1">Male</option>
          <option value="2">Female</option>
        </select>
      </li>
      <li class="label"> Street <span class="desc"> not required</span> </li>
      <li class="field">
        <input name="street" type="text" class="text"/>
      </li>
      <li class="label"> City <span class="desc"> required</span> </li>
      <li class="field">
        <input name="city" type="text" class="validate_blank text"/>
      </li>
     
      <!--      
      PLEASE READ : 
      ------------------------------------------------------------------------------------
      EASY TO ADD FIELDS 
      Doesn't need to edit your database table and  doesn't need to edit/add php codes
      
      How?
      1.) Try to remove the  html comment below for tag <li> ,after done removing the html comment just edit the config.php
          and change the value of AUTOMATIC_CREATE_FIELDS_FROM_FORM to true
          example:  define('AUTOMATIC_CREATE_FIELDS_FROM_FORM',true);
      
      2.) Take note in adding fields:
          <input name="zipcode"> = this will automatically creates  fieldname zipcode in  the database table. 
          <input name="#submit"> = form fields that includes "#" sharp character will be igonored
               
      3.) After done editing the config.php file refresh this page, the new fieldname is now created. 
      4.) You can turn off now the AUTOMATIC_CREATE_FIELDS_FROM_FORM. 
      -->
      
      <!-- 
      <li class="label"> Zipcode <span class="desc"> required</span> </li>
      <li class="field">
        <input name="zipcode" type="text" class="validate_blank text"/>
      </li>
      -->
      
      
      <li class="label"> </li>
      <li class="field">
        <input name="#agree" type="checkbox" value="1" class="validate_agree" />
        I agree the Terms and Condition (required) </li>
      <li class="label"> </li>
      <li class="field"> <img src="files/isubmit.jpg" class="submit" onclick="$('.<?php echo AJAX_FORM_ELEMENT?>').submit();"/>
        <input name="#submit" type="submit" style="display:none" />
      </li>
      <li class="label status"> <span class="ajax_wait">
        <!--don't delete this span class="ajax_wait"-->
        </span> 
      </li>
    </ul>
    <div class="ajax_target">
      <!--don't delete this div class="ajax_target" -->
    </div>
  </form>
  <?php 
   echo $ajaxRegistrationModule->initRegistration();
 ?>
</div>
</body>
</html>
Return current item: Ajax Registration Module