Mini Shell

Direktori : /home/rizant5/public_html_old/admin/
Upload File :
Current File : /home/rizant5/public_html_old/admin/edit-answer.php

<?php 

require_once("../config.php");

require_once("function-file.php");

require_once("function-menu.php");

cookiecheck();

$topic_id=$_GET['topic_id'];

$queid=$_GET['queid'];

$ansid=$_GET['ansid'];

$datas=$conn->prepare("select * from topics where topic_id='$topic_id'");

$datas->execute();$result=$datas->fetch();

if(isset($_POST['save']))

{

	$text=htmlspecialchars($_POST['edit_answer'],ENT_QUOTES);//$_POST['edit_answer'];

	$question=htmlspecialchars($_POST['question'],ENT_QUOTES);//$_POST['question'];

  // $conn->exec("insert into answers (que_id,datetime,text) values ('$queid',NOW(),'$text')");
	$conn->exec("update answers SET text='$text' where ans_id='$ansid' ");

	// $conn->exec("update question SET check_status='1',approve='1',text='$question' where que_id='$queid' ");

	header("location:answer.php?topic_id=".$topic_id."&queid=".$queid."#answer");

}

?>

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title><?php echo $result['topic_name'];?></title>

    <!-- Tell the browser to be responsive to screen width -->

    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <?php  cssfile();?>

    <style>iframe{width: 100% !Important;}</style>

  </head>

  <body class="hold-transition skin-blue layout-top-nav">

    <!-- Site wrapper -->

    <div class="wrapper">

<?php headermenu();?>

      <!-- =============================================== -->

      <!-- Content Wrapper. Contains page content -->

      <div class="content-wrapper">

        <!-- Content Header (Page header) -->

        <!-- Main content -->

        <section class="content">

          <!-- Default box -->

          <div class="box">

            <div class="box-header with-border">

              <h3 class="box-title"><?php echo $result['topic_name'];?></h3>

              <div class="box-tools pull-right">

                <a  href="javascript:history.back()" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>

              </div>

            </div>

            <div class="box-body">

              <div class="form-group">

              		<div class="col-sm-5 img-thumbnail col-xs-12"><?php echo $result['topic_desc'];?></div>

                    <div class="col-sm-6 img-thumbnail col-sm-offset-1 col-xs-12"><?php echo $result['video_url'];?></div>

              </div>

            </div><!-- /.box-body -->

          </div><!-- /.box -->

          <div class="box box-primary">

          	<div class="box-body">

            <form action="#" method="post">

              <div class="row form-group" id="answer">      

                    <div class="col-sm-12">

              <!-- The time line -->

              <ul class="timeline">

                <!-- timeline time label -->

                <?php $db=$conn->prepare("select * from question a inner join student_reg b on a.stu_id=b.stu_id where que_id='$queid'");

				$db->execute();$rows=$db->fetch();?>

                <!-- timeline item -->

                <li>

                  <i class="fa fa-envelope bg-blue"></i>

                  <div class="timeline-item">

                    <span class="time "><?php echo date('d M. Y',strtotime($rows['datetime']));?> - <i class="fa fa-clock-o"></i>  <?php echo date('h:i A',strtotime($rows['datetime']));?></span>

                    <h3 class="timeline-header"><?php echo $rows['stu_name'];?></h3>

                    <div class="timeline-body">

                      <textarea name="question" class="form-control" required disabled><?php echo $rows['text'];?></textarea>

                    </div>

                  </div>

                </li>

                <!-- END timeline item -->

                <?php $db=$conn->prepare("select a.datetime,a.ans_id,a.text,s.stu_name from answers a,student_reg s, question q where a.que_id='$queid' and q.stu_id=s.stu_id and a.que_id=q.que_id and a.ans_id='$ansid' ");

                $db->execute();$rows=$db->fetchAll();

                foreach($rows as $row){?>
                <!-- timeline item -->

                <li>

                  <i class="fa fa-envelope bg-blue"></i>

                  <div class="timeline-item">

                    <span class="time "><?php echo date('d M. Y',strtotime($row['datetime']));?> - <i class="fa fa-clock-o"></i>  <?php echo date('h:i A',strtotime($row['datetime']));?></span>

                    <h3 class="timeline-header"><?php echo $row['stu_name'];?></h3>

                    <div class="timeline-body">

                      <!--<textarea name="edit_answer" class="form-control" required disabled></textarea>-->

            		      <div class="row form-group" style="padding: 10px 30px;"><div class="col-sm-12" align="center"><textarea name="edit_answer" class="form-control" placeholder="Type your answer..." required><?php echo $row['text'];?></textarea></div></div>
                      <input type="hidden" name="ansid" value="<?php echo $ansid; ?>">
                      <input type="hidden" name="queid" value="<?php echo $queid; ?>">

                    </div>

                  </div>

                </li>

                <?php } ?>

                <!-- END timeline item -->

                <!-- timeline item -->

                <!-- END timeline item -->

               

              </ul>

              </div>

            </div>

            


                    <div class="row form-group"><div class="col-sm-12" align="center"><button type="submit" name="save" class="btn btn-success">Update Answer</button></div></div>

            </div>

            </form>

          </div><!-- /.box -->

        </section><!-- /.content -->

      </div></div><!-- /.content-wrapper -->

      <?php footer();?>

    </div><!-- ./wrapper -->

   <?php jsfile();ratenum();?>

   

  </body>

</html>


Zerion Mini Shell 1.0