Current File : /home/inlingua/public_html/sensoriumpsychologists.com/diagnostics/admin/add_edit_franchise.php |
<?php require_once("../franchise_between/admin_constants.php");?>
<?php require_once("../franchise_between/check_admin.php");?>
<?php require_once("../franchise_between/user_details_msg_setup.php");?>
<?php require_once("../franchise_back/connection.php");?>
<?php require_once("../franchise_back/database_admin.php");?>
<?php require_once("../franchise_back/validate_admin.php");?>
<?php require_once("../franchise_between/admin.php");?>
<?php
$editable="no";
if(isset($_GET['fid']) && ($_GET['fid']!=""))
{
$editable="yes";
}
$name="";
$username="";
$password="";
$status="active";
$fetch_obj = new admin;
if($editable=="yes")
{
$res=$fetch_obj->get_franchise_details($_GET['fid']);
if($res->num_rows!=1)
{
header("location:all_franchise.php");
exit();
}
$detail=$res->fetch_assoc();
$name=$detail['name'];
$username=$detail['username'];
$password=$detail['password'];
$status=$detail['status'];
}
if(isset($_POST['submit_form']))
{
extract($_POST);
if($editable=="no")
{
$msg=$fetch_obj->add_franchise($my_table_id,$name,$username,$password,$status);
if($msg=="ok")
{
$msg_print="Added successfully...!!!";
$temp_filename="all_franchise.php";
header("location:redirect_msg.php?q=".$temp_filename."&msg=".$msg_print);
exit(EXIT_ERROR);
}
}
else if($editable=="yes")
{
$msg=$fetch_obj->update_franchise($_GET['fid'],$name,$username,$password,$status);
if($msg=="ok")
{
$msg_print="Updated successfully...!!!";
$temp_filename="all_franchise.php";
header("location:redirect_msg.php?q=".$temp_filename."&msg=".$msg_print);
exit(EXIT_ERROR);
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<?php require("common/head_links.php");?>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<?php require("common/header.php");?>
<?php require("common/left_side_bar.php");?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<?php
if($editable=="yes")
{
?>
<h1>Update Franchise - <?php echo($detail['name']);?></h1>
<?php
}
else
{
?>
<h1>Add Franchise</h1>
<?php
}
?>
</section>
<!-- Main content -->
<section class="content">
<div class="row" style="margin-top:20px;">
<div class="col-xs-12">
<div class="box">
<div class="box-body" style="padding:50px 15px;">
<form class="form-horizontal" role="form" method="post">
<div class="form-group">
<label class="control-label col-md-2">Name:</label>
<div class="col-md-10">
<input type="text" class="form-control" name="name" id="name" value="<?php echo($name);?>" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">Username:</label>
<div class="col-md-10">
<input type="text" class="form-control" name="username" id="username" value="<?php echo($username);?>" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">Password:</label>
<div class="col-md-10">
<input type="text" class="form-control" name="password" id="password" value="<?php echo($password);?>" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">Status:</label>
<div class="col-md-10">
<select name="status" id="status" class="form-control" style="width:auto;">
<option value="active"
<?php
if($status=="active")
{
echo(" selected");
}
?>
>Active</option>
<option value="inactive"
<?php
if($status=="inactive")
{
echo(" selected");
}
?>
>In-Active</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<?php
if($editable=="no")
{
?>
<button type="submit" class="btn btn-success" name="submit_form">Add Now</button>
<?php
}
else
{
?>
<button type="submit" class="btn btn-success" name="submit_form">Update Now</button>
<?php
}
?>
<a href="all_franchise.php"><div class="btn btn-danger">Cancel</div></a>
</div>
</div>
</form>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<?php require("common/footer.php");?>
</div><!-- ./wrapper -->
<?php require("common/footer_links.php");?>
</body>
</html>