<?php session_start();
?>
<?php
include('config.php');
?>
<html>
<?php include 'header.php'; ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3 /jquery.min.js"></script>
<div id="content">
<h3 class="page-title">Jobseeker Registration</h3>
<!--<div class="post">-->
<?php
echo $a=$_SESSION['email_check']; ?>
// This section is form **validation function** which i am calling from button.
<script LANGUAGE="JavaScript">
function ValidateForm(form){
ErrorText= "";
if (document.frm.f_name.value == "" )
{
alert ( "Please enter full name" );
document.frm.f_name.focus();
return false;
}
if ( ( form.gender[0].checked == false ) && ( form.gender[1].checked == false ) && ( form.gender[2].checked == false ) )
{
alert ( "Please choose your Gender: Male or Female or other" );
return false;
}
var phoneno = /^\d{10}$/;
if (document.frm.m_number.value == "" )
{
alert ( "Please enter valid mobile number" );
document.frm.m_number.focus();
return false;
}
else if(!(document.frm.m_number.value.match(phoneno)))
{
alert("Not a valid Phone Number");
document.frm.m_number.focus();
return false;
}
if (document.frm.edu_ql.selectedIndex == "" )
{
alert ( "Please Select Education Qualification" );
document.frm.edu_ql.focus();
return false;
}
if (document.frm.address.value == "" )
{
alert ( "Please fill ur complete address" );
document.frm.address.focus();
return false;
}
if ( ( document.frm.country.selectedIndex == 0 ))
{
alert ( "Please Select Country" );
return false;
}
if ( ( document.frm.state.selectedIndex == 0 ))
{
alert ( "Please Select state" );
return false;
}
if ( ( document.frm.city.selectedIndex == 0 ))
{
alert ( "Please Select city" );
return false;
}
var regPostcode = /^([1-9])([0-9]){5}$/;
if (document.frm.pin.value == "" )
{
alert ( "Please enter valid postal code" );
document.frm.pin.focus();
return false;
}
else if(!(document.frm.pin.value.match(regPostcode)))
{
alert("Not a postal code");
document.frm.pin.focus();
return false;
}
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (document.frm.empl_emailid.value == "" )
{
alert ( "Please enter valid emailid" );
document.frm.empl_emailid.focus();
return false;
}
else if(!(document.frm.empl_emailid.value.match( mailformat)))
{
alert("Not a valid Email id");
document.frm.empl_emailid.focus();
return false;
}
if (document.frm.pass.value == "" )
{
alert ( "Please fill ur password" );
document.frm.pass.focus();
return false;
}
if (document.frm.ppwd.value == "" )
{
alert ( "Please fill confirm password" );
document.frm.ppwd.focus();
return false;
}
if(document.frm.pass.value != document.frm.ppwd.value)
{
alert ( "Please match password" );
document.frm.ppwd.focus();
return false;
}
else
{
return true;
}
if (ErrorText= "") { form.submit() }
}
<!-- random number -->
function getRandomString($length = 10) {
$validCharacters = “abcdefghijklmnopqrstuxyvwz1234567890+-*#&@!?”;
$validCharNumber = strlen($validCharacters);
$result = “”;
for ($i = 0; $i < $length; $i++) {
$index = mt_rand(0, $validCharNumber – 1);
$result .= $validCharacters[$index];
}
echo $result;
return $result;
}
$result = getRandomString();
<!-- Random ends -->
</script>
// now my form section started where i will call the function.
<form action="process_referral_register.php" method="post" enctype="multipart/form-data" name="frm" id="frm" style="border:none; margin:0">
<div class="col-md-6">
<div class="form-group">
<label>Full name</label>
<input type="text" name="f_name" class="form-control" required></div>
</html>
<input type="button" class="btn btn-denger" onClick="window.location.href='index.php'" value="cancel">
<input class="btn btn-success" type="submit" name="employee" value="submit →" onClick="return ValidateForm(this.form);getrandomstring(); "></div>
我的表单已经开始,最后我会调用提交按钮和 onclick 事件的更多表单字段。但点击事件不适用于这两个功能。**请帮助。我的表格有很多字段,我在这里没有提到。请帮忙。