<!DOCTYPE html>
<html>
<head>
<title>Empform</title>
<style type="text/css">
#myForm label.error
{
margin-left: 10px;
width: auto;
display: inline;
color: red;
}</style>
</head>
<body>
<form method="post" name="myForm" id="myForm" enctype="multipart/form-data">
<div align="right">
<table>
<tr>
<td>
<span style="text-transform:capitalize;">Welcome
<?php echo $this->session->userdata('username');?>
</span>
</td>
<td></td>
<td>
<a href="<?php echo base_url();?>emp/fetch">View</a>
</td>
</tr>
</table>
</div>
<fieldset>
<div align="center">
<table>
<tr>
<td>Username</td>
<td>
<input type="text" id="username" name="username" onkeyup="nospaces(this)" />
</tr>
<tr>
<td>Password</td>
<td><input type="text" id="password" name="password" class="text"></td>
</tr>
<tr>
<td>CnfPassword</td>
<td><input type="text" name="confirm_password" id="confirm_password" class="text"></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" id="address" name="address" class="text"></td>
</tr>
<tr>
<td>Contact</td>
<td><input type="text" id="contact" name="contact" class="text"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" id="email" class="text"></td>
</tr>
<tr>
<td>Gender</td>
<td ><input type="radio" id="gender" name="gender" checked="checked" value="male">Male
<input type="radio" name="gender" id="gender" value="female">Female</td>
</tr>
<tr>
<td>City:</td>
<td>
<select name="city" id="city" class="text">
<option hidden="">Choose city</option>
<option value="surat">Surat</option>
<option value="nadiad">Nadiad</option>
<option value="Baroda">Baroda</option>
</select>
</td>
</tr>
<tr><td>Hobby</td>
<td>
<input type="checkbox" name="hobby[]" value="teniss"/>teniss
<input type="checkbox" name="hobby[]" value="football"/>football
<input type="checkbox" name="hobby[]" value="cricket"/>cricket
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="submit" id="submit">
</td></tr>
</table>
</div>
</fieldset>
<fieldset>
<input type="button" value="listview" id="listview">
</fieldset>
</form>
<form method="post" name="upd_myForm" id="upd_myForm">
<div id="dataall">
</div>
</form>
<script type="text/javascript" src="<?php echo base_url();?>public/assets/js/jquery-2.2.3.min.js">
</script>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/jquery.validate.js"></script>
<!--Start show update data with textbox-->
<script type="text/javascript">
function update(id)
{
alert(id);
$("#row_"+ id).hide();
$("#input_row_"+id).show();
}
</script>
<!--End show update data with textbox-->
<script type="text/javascript">
$("#listview").click(function()
{
// alert('btn clicked');
var url1= "<?php echo base_url().'emp/getvalues'?>";
var form = $("#dataall").serialize();
$.ajax({
type:"POST",
url: url1,
data: form,
success: function (data)
{//alert(data);
$('#dataall').html(data);
}
});
});
</script>
<!-- start for insert data with ajax -->
<script type="text/javascript">
$("#submit").click(function()
{
//alert('btn clicked');
var url1= "<?php echo base_url().'emp/ajx_test'?>";
var form = $("#myForm").serialize();
// alert(form);
$.ajax({
type:"POST",
url: url1,
data: form,
success: function (data)
{
// alert(success);
//$('.sort').append(data);
//window.location.reload();},
}
});
});
</script>
<!-- End for insert data with ajax -->
<!-- start Validation with Jquery -->
<script type="text/javascript">
function nospaces(t)//username space not allowed
{
if(t.value.match(/\s/g)){
t.value=t.value.replace(/\s/g,'');
}
}
$(document).ready(function()
{ // alert('vickerer');
$("#myForm").validate({
rules:
{
username: {
required: true,
minlength: 2,
remote:{
type: "POST",
url:"<?php echo base_url().'emp/check_username_availablity'?>",
data: { username : function(){
return $("#username").val();
}
}
}
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
},
address: {
required: true,
},
contact: {
required: true,
minlength:10,
},
email: {
required: true,
email: true
},
},
messages: {
username: {
required: "Please provide a username",
minlength: "Your username must be at least 2 characters long",
remote:"already exists"
},
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
confirm_password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long",
equalTo: "Please enter the same password as above"
},
email: "Please enter a valid email address",
address:"Please enter address",
contact:
{
required:"Please enter contact Number",
minlength: "Your Contact must be at least 10 Number long"
}
}
});
})
</script>
<!-- End Validation with Jquery -->
<!-- start Validation with Jquery -->
<script type="text/javascript">
var baseeee='<?php echo base_url().'emp/check_username_for_update'?>';
$("#upd_myForm").validate({
rules:
{
upd_username: {
required: true,
remote: {
url: baseeee,
type: "post",
data: { uname: function() {
return $( "#upd_username" ).val();
} }
}
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
},
address: {
required: true,
},
contact: {
required: true,
minlength:10,
},
email: {
required: true,
email: true
},
},
messages: {
upd_username: {
minlength: "Your username must be at least 2 characters long",
remote: "already existbbbbbbbbbbbbbbs"
},
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
confirm_password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long",
equalTo: "Please enter the same password as above"
},
email: "Please enter a valid email address",
address:"Please enter address",
contact:
{
required:"Please enter contact Number",
minlength: "Your Contact must be at least 10 Number long"
}
}
});
$(document ).ready(function()
{ // alert('vickerer');
});
</script>
<!-- End Validation with Jquery -->
<!--
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("dataall").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
</script>
-->
</body>
</html>