ESH/questionaire_master_save.php
2024-10-23 18:28:06 +05:30

43 lines
1.7 KiB
PHP

<?php
include('includes/config/config.php');
include('log_entry.php');
include ('includes/functions.php');
error_log ( "Start Printing Request Attributes" );
$requestStr="";
foreach ( $_REQUEST as $key => $value ) {
$requestStr.=$key . " : " . $value . "\n";
error_log ( $key . " : " . $value . "<br />\r\n" );
}
error_log ( "End Printing Request Attributes" );
save_log($requestStr,'Questionnaire Master','SAVE','questionaire_master_save.php');
$question_id = $_POST['question_id'];
$question =$_POST['question'];
$question_local =$_POST['question_local_lang'];
$question_type = $_POST['question_type'];
$question_sequence = $_POST['question_sequence'];
$setion_name = $_POST['section_name'];
$sub_section_available = $_POST['sub_section_available'];
$sub_section_order = $_POST['sub_section_order'];
if(!empty($question_id)){
$query = "update questionaire_master set question = '$question',question_local_lang = '$question_local_lang', question_type = '$question_type', question_sequence = '$question_sequence',section_name = '$section_name',sub_section_available='$sub_section_available',sub_section_order='$sub_section_order', modified_by = '".$_SESSION['user_id']."' where question_id = '".$question_id."'";
}
else {
$query = "insert into questionaire_master(question,question_local_lang,question_type,question_sequence,section_name,sub_section_available,sub_section_order, modified_by)
values ('$question','$question_local_lang', '$question_type','$question_sequence','$section_name','$sub_section_available','$sub_section_order','".$_SESSION['user_id']."' ); ";
}
error_log("query".$query);
if (!$result = @mysqli_query($conn,$query)) {
error_log("query error".$mysqli_error($conn));
exit(mysqli_error($conn));
}
echo json_encode($data);