Location: PHPKode > projects > Itshomi PHP Framework > itshomi/components/imiuser/en_NewUserForm.php
<script language="javascript">
<!--
function submitProfile(uform){
	emregex = /\S+@\S+\.\S{2,4}/;
	if(uform.password.value.length==0){
		alert("password can not be empty");
		return false;
	}
	if(uform.password.value.length<6){
		alert("password must be at least 6 characters long");
		return false;
	}
	if(uform.username.value.length==0){
		alert("username can not be empty");
		return false;
	}
	if(uform.fname.value.length==0){
		alert("firstname can not be empty");
		return false;
	}
	if(uform.lname.value.length==0){
		alert("lastname can not be empty");
		return false;
	}
	if(uform.email.value.length==0){
		alert("you must provide your e-mail address");
		return false;
	}
	if(!emregex.exec(uform.email.value)){
		alert("email address is not valid");
		return false;
	}
	if(uform.country.value.length==0){
		alert("please select your country");
		return false;
	}
	if(uform.vcode.value.length==0){
		alert("please enter the code into the text box below");
		return false;
	}
    if(uform.password.value!=uform.rpwd.value){
        alert("Both passwords must match ");
        return false;
    }
	
    return true;
}
// -->
</script>
<?
include_once($this->imipath.'/utils/FormData.php');
$formData = $_REQUEST['formdata'];
if(!isset($formData))
{
	$formData = new FormData();
}else
{
	$formData = unserialize($formData);
}
include_once($this->imipath."/utils/Util.php");
$country = $this->getUtil('DropDown');
$country->init("country");
include_once($this->imipath."/utils/countrylist.inc.php");
if(strlen($formData->getField("country"))>0){
	$country->setSelectedOption($formData->getField("country"));
}	
$code = getSecurityCode(5);
$_SESSION["tmpvar1"]=$code;
$secureRef = "";
	$showForm = true;
	$msg = "Please enter your details below";
	if($_SESSION['LoggedIn']){
		if($_SESSION['roleid']==4)
			$msg = "Please enter user details below";
		else{
			$msg = "You are already registered";
			$showForm = false;	
        }
    }
	echo($msg);
	if($showForm){
	?>
. Fields prefixed with * are required.<br>
<form name="form1" method="POST" action="<? echo($_SERVER["PHP_SELF"]);?>"  onsubmit="return submitProfile(this)">
						<p>
			 <table border="1">
    <tr>
      <td colspan="2" bgcolor="#ccccFF">Login Information</td>
    </tr>
    <tr>
      <td>*Username</td>
      <td><input type="text" name="username" size="20" value="<? echo($formData->getField("username"));?>"></td>
    </tr>
    <tr>
      <td>*Password</td>
      <td><input type="password" name="password" size="20"></td>
    </tr>
    <tr>
      <td>*Re-type password</td>
      <td><input type="password" name="rpwd" size="20"></td>
    </tr>
	<tr>
      <td colspan="2" bgcolor="#ccccdd">Contact Information</td>
    </tr>
    <tr>
      <td>*Firstname</td>
      <td><input type="text" name="fname" size="20" value="<? echo($formData->getField("fname"));?>"></td>
    </tr>
    <tr>
      <td>*Lastname</td>
      <td><input type="text" name="lname" size="20" value="<? echo($formData->getField("lname"));?>"></td>
    </tr>
    <tr>
      <td><span title="Your e-mail address is required">*e-mail address</span></td>
      <td><input type="text" name="email" size="20" value="<? echo($formData->getField("email"));?>" title="either e-mail address or phone number required"></td>
    </tr>
    <tr>
      <td>Telephone or Cell</td>
      <td><input type="text" name="phone" size="20" value="<? echo($formData->getField("phone"));?>"></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#ccccdd">General Information</td>
    </tr>
    <tr>
      <td>Date of birth<br>(ccyy-mm-dd)ex.: 1966-02-20</td>
      <td><input type="text" name="birthdate" size="20" value="<? echo($formData->getField("birthdate"));?>"></td>
    </tr>
    <tr>
      <td>Gender</td>
      <td><? echo(getGenderHtml($formData));?></td>
    </tr>
    <tr>
      <td>*Country</td>
      <td><? echo($country->toHtml());?></td>
    </tr>
	<tr>
      <td>Province</td>
      <td><input type="text" name="province" /></td>
    </tr>
    <tr>
      <td>Enter this code</td>
      <td><? echo($code);?></td>
    </tr>
    <tr>
      <td>*Into this textbox</td>
      <td><input type="text" name="vcode" size="20"></td>
    </tr>
  </table>
  
	<hr>
	<p>
  <input type="hidden" name="{$EVENT_LBL}" value="adduser">
  <input type="submit" value="Submit" class="button">
  <input type="reset" value="Reset" class="button"></p><p>&nbsp;
  </p>
</form>
<? }?>
Return current item: Itshomi PHP Framework