File: /home/cafsindia/refimac_cafsjobs_com/mas_model.php
<div id="contentwrapper">
<div class="main_content">
<?php
$up=$_REQUEST['up'];
$id=$_REQUEST['id'];
if($up==1)
{
$sql="select * from model where MODEL_ID=".$id."";
$qu=mysql_query($sql);
$r=mysql_fetch_array($qu);
$MODEL_CODE=$r['MODEL_CODE'];
$MODEL_ID=$r['MODEL_ID'];
$MODEL_NAME=$r['MODEL_NAME'];
$MAKE_ID=$r['MAKE_ID'];
}
?>
<div class="page-head">
<div class="container">
<!-- BEGIN PAGE TITLE -->
<div class="page-title">
<h1>Model Master <small>Manage your Model.</small></h1>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row-fluid">
<div class="span12">
<?php
if($nav=="1"||$nav=="3")
echo "<div class='alert alert-success'>
<span>Given information successfully updated !</span>
</div>";
elseif($nav=="2"||$nav=="4"||$nav=="6")
echo "<div class='alert alert-warning'>
<span>sorry, given information not updated, please try again !</span>
</div>";
elseif($nav=="5")
echo "<div class='alert alert-danger'>
<span>Selected Record successfully deleted !</span>
</div>";
?>
</div>
</div>
<div class="page-content-inner">
<form name="form1" action="<?php if($up==1)echo "ad"; else echo "ad";?>d_details.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>" method="post">
<div class="portlet light">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Model Name<span class="f_req">*</span></label>
<input name="MODEL_NAME" type="text" class="form-control" id="MODEL_NAME" value="<?php echo $MODEL_NAME;?>" />
<input name="MODEL_ID" type="hidden" class="form-control" id="MODEL_ID" value="<?php echo $MODEL_ID;?>" />
<span class="help-block">Please enter model name</span>
</div>
<div class="col-md-3">
<label>Make <span class="f_req">*</span></label>
<select name="MAKE_ID" class="form-control select2" id="MAKE_ID" >
<option value="Select">Select Sub Menu</option>
<?php
$sql1="select MAKE_NAME,MAKE_ID from make";
$qu1=mysql_query($sql1);
while($r1=mysql_fetch_array($qu1))
{
?>
<option <?php if($MAKE_ID==$r1['MAKE_ID']) echo "Selected='Selected'";?> value="<?php echo $r1['MAKE_ID'];?>"><?php echo $r1['MAKE_NAME'];?></option>
<?php } ?>
</select>
<span class="help-block">Please select Make</span>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green">Submit</button>
<button type="button" class="btn grey-salsa btn-outline cancel">Cancel</button>
</div>
</div>
</div>
</div>
</form>
<div class="row portlet light">
<div class="col-md-12">
<h3 class="heading">View / Search / Update Employee </h3>
<table class="table table-striped table-bordered table-hover dt-responsive" id="sample">
<thead>
<tr>
<th>S.No.</th>
<th>Model Code </th>
<th>Model name </th>
<th>Make </th>
<th>Created date </th>
<th>Update</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
$sql1="select MODEL_ID,MODEL_CODE,MODEL_NAME,(select MAKE_NAME from make where MAKE_ID=model.MAKE_ID) as MAKE_NAME,created_date from model where status=1";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $rd['MODEL_CODE'];?></td>
<td><?php echo $rd['MODEL_NAME'];?></td>
<td><?php echo $rd['MAKE_NAME'];?></td>
<td><?php echo $rd['created_date'];?></td>
<td class="center"><a href="landing.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&id=<?php echo $rd['MODEL_ID'];?>&up=1" class="sepV_a" title="Edit"><i class="icon-pencil"></i></a></td>
<td class="center"><a href="del_detail.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&id=<?php echo $rd['MODEL_ID'];?>" onclick="return confirm('Are you sure you wish to delete this record ?')" title="Delete"><i class="icon-trash"></i></a></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function()
{
if ( $.fn.dataTable.isDataTable( '#sample' ) ) {
table = $('#sample').DataTable();
}
else {
table = $('#sample').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print','pageLength'
], lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
]
} );
}
$('.cancel').click(function()
{
location.reload();
});
});
// Wait for the DOM to be ready
$(function() {
// Initialize form validation on the registration form.
// It has the name attribute "registration"
$("form[name='form1']").validate({
// Specify validation rules
rules: {
// The key name on the left side is the name attribute
// of an input field. Validation rules are defined
// on the right side
EMP_NAME: "required",
EMP_MOBILE: "required",
EMP_DOJ: {
required: true,
// Specify that email should be validated
// by the built-in "email" rule
//email: true
}
},
// Specify validation error messages
messages: {
EMP_NAME: "Please enter employee name",
EMP_MOBILE: "Please enter employee mobile",
page_name: "Please select doj"
},
// Make sure the form is submitted to the destination defined
// in the "action" attribute of the form when valid
submitHandler: function(form) {
form.submit();
}
});
});
</script>