Current File : /home/inlingua/www/sensoriumpsychologists.com/backup/diagnostics/franchise/data_screening/index.php |
<?php
require_once("../../franchise_between/check_franchise.php");
require("common/connection.php");
require_once("common/user_details_msg_setup.php");
//session_start(); '<pre>'; print_r($_POST);
$new_conn = new mysqli($host_db,$user_db,$pass_db,$name_db);
if ($new_conn->connect_errno)
{
echo("COULD NOT CONNECT TO THE SERVER.....TRY AGAIN LATER");
exit();
}
if(isset($_POST['to_delete'])&&($_POST['to_delete']!="none"))
{
$new_conn->query("DELETE FROM shristi_questionnaires WHERE table_id='{$_POST['to_delete']}'");
$new_conn->close();
$msg="Deleted successfully...";
$temp_filename="index.php";
header("location:redirect_back.php?q=".$temp_filename."&msg=".$msg);
exit("Couldn't redirect");
}
else if(!empty($_POST))
{
extract($_POST);
$created_date=date('Y-m-d');
$created_by=$_SESSION['log_id'];
echo "INSERT INTO shristi_questionnaires(name,questionnaire_type,duration,for_std,status,created_date,created_by) VALUES('$name','$questionnaire_type','$duration','$for_std','$status','$created_date','$created_by')";
if($new_conn->query("INSERT INTO shristi_questionnaires(name,questionnaire_type,duration,for_std,status,created_date,created_by) VALUES('$name','$questionnaire_type','$duration','$for_std','$status','$created_date','$created_by')"))
{
$new_conn->close();
$msg="Added successfully...";
$temp_filename="index.php";
header("location:redirect_back.php?q=".$temp_filename."&msg=".$msg);
exit("Couldn't redirect");
}
else
{
$new_conn->close();
echo("Error : <a href=\"index.php\">Go Back</a>");
exit();
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SCREENING CODE</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="common/jquery_file.js"></script>
</head>
<body>
<?php
if($msg!="")
{
?>
<script>
alert("<?php echo($msg);?>");
</script>
<?php
}
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>ENTER NEW SCREENING </h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<form method="post" role="form" name="delete_form">
<input type="hidden" name="to_delete" id="to_delete" value="none" />
</form>
<form method="post" role="form" name="entry_form">
<div class="form-group col-md-3">
<label>Questionnaire</label>
<select name="name" id="code">
<?php for($i=1; $i<=20; $i++) { ?>
<option value="questionnaire <?php echo $i;?>"><?php echo $i;?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label>Type</label>
<select name="questionnaire_type" id="grade">
<option value="always kee">Always kee</option>
<option value="1">1</option>
</select>
</div>
<div class="form-group col-md-3">
<label>DURATION</label>
<select name="duration" id="month">
<option value="30">30</option>
<option value="60">60</option>
<option value="90">90</option>
<option value="120">120</option>
</select>
</div>
<div class="form-group col-md-3">
<label>For Std</label>
<select name="for_std" id="week">
<option value="[1],[2]">1,2</option>
<option value="[3]">3</option>
<option value="[4]">4</option>
<option value="[5]">5</option>
</select>
</div>
<div class="form-group col-md-3">
<label>Status</label>
<select name="status" id="day">
<option value="active">Active</option>
</select>
</div>
<div class="clearfix"></div>
<div class="form-group">
<input type="submit" class="btn btn-success" />
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h1>SCREENING AVAILABLE</h1>
</div>
<div class="col-md-12 table-responsive">
<table class="table table-striped table-responsive">
<tr>
<th>S.NO</th>
<th>NAME</th>
<th>TYPE</th>
<th>DURATION</th>
<th>FOR STD.</th>
<th>STATUS</th>
<th>CREATED DATE</th>
<th></th>
<th></th>
</tr>
<?php
$sno=1;
$res=$new_conn->query("SELECT * FROM shristi_questionnaires");
$new_conn->close();
while($detail=$res->fetch_assoc())
{
echo("<tr>");
echo("<td>".$sno."</td>");
echo("<td>".$detail['name']."</td>");
echo("<td>".$detail['questionnaire_type']."</td>");
echo("<td>".$detail['duration']."</td>");
echo("<td>".$detail['for_std']."</td>");
echo("<td>".$detail['status']."</td>");
echo("<td>".$detail['created_date']."</td>");
echo("<td><a href=\"data_entry_treatments_main_questions.php?treatment_id=".$detail['table_id']."\"><div class=\"btn btn-danger\">Questions</div></a></td>");
echo("<td><a href=\"javascript:delete_treatment('".$detail['table_id']."')\"><div class=\"btn btn-danger\">Delete</div></a></td>");
echo("</tr>");
$sno++;
}
?>
</table><br>
</div>
</div>
</div>
<script>
function delete_treatment(to_delete)
{
var confirm_ans=confirm("Delete Permanently");
if(confirm_ans==true)
{
$("#to_delete").val(to_delete);
document.delete_form.submit();
}
else
{
return false;
}
}
</script>
</body>
</html>