mercredi 22 avril 2015

unexpected output of checked checkboxes

i have these codes which are when user select checkbox the checked will be appear in

and my code is work but the result is not what i expected it only appear Arr rather than value of checkbox. this is tt.php:

<?php session_start();
if (! empty($_SESSION['logged_in']))
{
?>


<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<meta charset="utf-8">
<link href="style111.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
<script src="http://ift.tt/J5OMPW" type="text/javascript"></script>
<script src="script.js"></script>
</head>
<body>
<div id="background">
<div id="page">
<div class="header">
  <div class="footer">
    <div class="body">
      <div id="sidebar"> <a href="#"><img id="logo" src="logo1.gif" width="170" height="170" alt="AES" title="AES logo"></a>
    <div id='cssmenu'>
<ul class="vertical">
<li><a href='home.php'><span>Home</span></a></li>
<li><a href='syllabus.php'><span>Syllabus</span></a>

</li>
<li><a href='Ass_PLO.php'class="last"><span>Assessment's PLO</span></a></li>
<li class='active has-sub'><a href='#'><span>Mapping Analysis</span></a>
  <ul>

           <li><a href='#'><span>Mapping matrix</span></a></li>
           <li><a href='aggeregate_matrix.php'><span>Aggregate mapping matrix</span></a></li>
           <li class='last'><a href='plomapping.php'><span>PLO mapping</span></a></li>
        </ul>
     </li>



   <li><a href='about.php'class="last"><span>About</span></a></li>
</ul>
</div>
        <div class="footenote"> <span> 2015 &copy; by Ghaya, Asma, Afnan and Sahar</span> <span> All rights reserved.</span> </div>
      </div>
      <div id="content">
       <div class="dropdown">
 <section class="main">
            <div class="wrapper-demo">
                <div id="dd" class="wrapper-dropdown-5" tabindex="1"><img class="profile-circle" src="avatar.png"/> &nbsp;<?php echo $_SESSION['username'] ; ?>
                    <ul class="dropdown">
                        <li><a href="myprofile.php">My Profile</a></li>
                        <li><a href="mycourses.php">My Courses</a></li>
                        <li><a href="logout.php">Log out</a></li>
                    </ul>
                </div>
            ​</div>
        </section>
        <script type="text/javascript" src="http://ift.tt/V757Mh"></script>
    <script type="text/javascript">

        function DropDown(el) {
            this.dd = el;
            this.initEvents();
        }
        DropDown.prototype = {
            initEvents : function() {
                var obj = this;

                obj.dd.on('click', function(event){
                    $(this).toggleClass('active');
                    event.stopPropagation();
                }); 
            }
        }

        $(function() {

            var dd = new DropDown( $('#dd') );

            $(document).click(function() {
                // all dropdowns
                $('.wrapper-dropdown-5').removeClass('active');
            });

        });

    </script>
</br>
        <div class="content">
        <div class="container">
        <strong>Course Code:</strong>  &nbsp; 
<?php
    echo $Course=$_SESSION['course'];
  ?> 
 <form action="tt3.php" method="POST" >
 <TABLE >
<h1>LIST OF ALL COURSES: </h1><br>
<TR>
<td><input type="checkbox" value="css" name='c[]'/>cs</td>
<td><input type="checkbox" value="pss" name='c[]'/>ps</td>
<td><input type="checkbox" value="ess" name='c[]'/>es</td>
<br> <br></tr><tr>
<input type='submit' value='submit'> <br>
</TR>
</TABLE></form></div><div><p>
<?php
$con=mysqli_connect("localhost","FYP","123","FYP");
$sql= mysqli_query($con, "SELECT Syll_PLO FROM syll_info WHERE C_Code='$Course'");
while($row = mysqli_fetch_array($sql)){
echo $row['Syll_PLO'];
}
?></p>
</div>
</div>
      </div>
    </div>
  </div>
</div>
<div class="shadow"> </div>
  </div>
</div>
</body>
</html>
<?php
}
else
{
echo 'You are not logged in. <a href="login.html">Click here</a> to log in.';
}

And this tt3.php:

<?php
session_start();
if (! empty($_SESSION['logged_in']))
{
$con=mysqli_connect("localhost","FYP","123","FYP");
$Course=$_SESSION['course'];
$c=$_POST['c'];
        $sql="INSERT INTO SYLL_INFO(C_Code,Syll_PLO) VALUES     ('$Course','$c')";
        mysqli_query($con,$sql);

        header ("location: tt.php");
}
else
{
echo 'You are not logged in. <a href="login.html">Click here</a> to log in.';
}

?>

enter image description here




Aucun commentaire:

Enregistrer un commentaire