javascript - Unexpected output of checked checkboxes -


i have these codes when user select checkbox checked appear in

, code work result not expected appear arr rather value of checkbox. 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://code.jquery.com/jquery-latest.min.js" 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; ghaya, asma, afnan , sahar</span> <span> 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://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></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() {                 // 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 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 syll_info 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 not logged in. <a href="login.html">click here</a> log in.'; } 

and 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 syll_info(c_code,syll_plo) values     ('$course','$c')";         mysqli_query($con,$sql);          header ("location: tt.php"); } else { echo 'you not logged in. <a href="login.html">click here</a> log in.'; } 

?>

enter image description here

c[] coming through array (which makes sense considering these checkboxes. try output

foreach ($_post['c']) $c  {     echo $row['syll_plo']; } 

or (i'm not sure in field, appears array, data coming through way). may need modify bit match data (i'm guessing based on see)


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -