<?php 
include('authentication.php');
include('includes/header.php');
include('includes/topbar.php');
include('includes/sidebar.php');
?>

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="m-0"> QR Code Answers</h1>
                </div><!-- /.col -->
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active">QR Code Answers</li>
                    </ol>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">



            <div class="card">
                <div class="card-header">
                    <h4>
                         QR Code Answers
                        <a href="qrcode_answers.php" class="btn btn-danger float-sm-right">BACK</a>
                    </h4>
                </div>
                <?php 
                $id = $_GET['id'];
                if(isset($id)){
                $ref = "QR Code Answers/$id/";
                        $fetchdata = $database->getReference($ref)->getValue();
                        }?>
                <div class="card-body">
                    <form action="code.php" method="POST" id="catform" enctype="multipart/form-data">
                        <div class="form-group mb-3">
                            <input type="text" name="answers"  value="<?php if(isset($id)){echo($fetchdata['answers']);}?>" placeholder="a,b,c,d,e,f"  class="form-control" required>
                        </div>
                        
                         <div class="form-group mb-3">
                            <input type="text" name="mattress_name"  value="<?php if(isset($id)){echo($fetchdata['mattress_name']);}?>" placeholder="Mattress Name"  class="form-control" required>
                        </div>
                        <div class="form-group mb-3">
                            <input type="text" name="mattress_name_2"  value="<?php if(isset($id)){echo($fetchdata['mattress_name_2']);}?>" placeholder="Mattress Name 2"  class="form-control" required>
                        </div>
                        <div class="form-group mb-3">
                            <input type="text" name="mattress_name_3"  value="<?php if(isset($id)){echo($fetchdata['mattress_name_3']);}?>" placeholder="Mattress Name 3"  class="form-control" required>
                        </div>
                       
                       
                        <div class="form-group mt-3">
                            <button type="submit" name="<?php if(isset($id)){echo('update_qrcode_answer_btn');}else{echo('add_qrcode_answer_btn');}?>"
                                value="<?php if(isset($id)){echo($id);}?>" class="btn btn-primary float-sm-right">Submit</button>
                        </div>
                    </form>
                </div>

            </div>
        </div>


    </section>
</div><!-- /.container-fluid -->

<?php
include('includes/script.php');
include('includes/footer.php');
?>