Read

$pdo = require 'connect.php';

$sql = 'SELECT publisher_id, name 

FROM publishers';

$statement = $pdo->query($sql);

// get all publishers

$publishers = $statement->fetchAll(PDO::FETCH_ASSOC);

if ($publishers) {

// show the publishers

foreach ($publishers as $publisher) {

echo $publisher['name'] . '<br>';

}

} 

<?php

$publisher_id = 1;

// connect to the database and select the publisher

$pdo = require 'connect.php';

$sql = 'SELECT publisher_id, name 

FROM publishers

        WHERE publisher_id = :publisher_id';

$statement = $pdo->prepare($sql);

$statement->bindParam(':publisher_id', $publisher_id, PDO::PARAM_INT);

$statement->execute();

$publisher = $statement->fetch(PDO::FETCH_ASSOC);

if ($publisher) {

echo $publisher['publisher_id'] . '.' . $publisher['name'];

} else {

echo "The publisher with id $publisher_id was not found.";

}

$year = "ICT1_1";

$sql3 = "Select * from subject where Year = '$year' ";

$subject = $con->query($sql3);

?>

<div style="width:90%; margin-left:5%; padding-top:0px; margin-top:0px;"><center><img src="test.jpg" height="150px" width="100%" style="padding-top:0px; margin-top:0px;"></center></div>

<div style="width:90%; margin-left:5%; background-color:#FFF;">

<form action="#" method="POST" enctype="multipart/form-data">

<center><h2 style="font-family:'Phetsarath OT'; color:#F00;">ແບບປະເມີນຜົນ ການສິດສອນຂອງອາຈານ</h2></center>

<p style="font-family:'Phetsarath OT'; font-size:24px; color:#F00; margin-left:5%">I. ນັກສຶກສາເລືອກລະດັບ ເພື່ອປະເມີນອາຈານສອນປະຈໍາວິຊາໃຫ້ຄົບທັງໝົດທຸກຂໍ້ຢ່າງລະອຽດ. </p><br />

<center>

<table style="width:90%; border:0px;">

<?php

$i = 0;

       while($rs2 = $q5->fetch_assoc()){

          $i++;  

      ?>

<tr>

<td style="width:55%;"> <input type="text" class="opt1"  style="height:35px; width:100%; font-family:'Phetsarath OT'; font-size:18px; color:#00F; border:0px;" name="t1[]" placeholder="" value="<?php echo $i . ': ' . $rs2['Name']; ?>"></td>

<td style="width:8%; font-family:'Phetsarath OT'; font-size:18px; color:#00F;"><center><input type="radio" name="t2[]<?php echo $i; ?>" value="1" required> ປັບປຸງ</center></td>

<td style="width:8%; font-family:'Phetsarath OT'; font-size:18px; color:#00F;"><center><input type="radio" name="t2[]<?php echo $i; ?>" value="2" required> ດີ</center></td>

<td style="width:8%; font-family:'Phetsarath OT'; font-size:18px; color:#00F;"><center><input type="radio" name="t2[]<?php echo $i; ?>" value="3" required> ດີຫຼາຍ</center></td>

</tr>

<?php

       }?>

<tr>

<td colspan="6" style="border:none;"><br>

<p style="font-family:'Phetsarath OT'; font-size:24px; color:#F00;">II. ຖ້າມີຄໍາເຫັນເພີ່ມເຕີມກັບແຕ່ລະອາຈານປະຈໍາວິຊາ, ໃຫ້ຄໍາເຫັນໂດຍຫຍໍ້ (ບໍ່ຄວນເກີນ 50 ຄໍາສັບ) </p><br />

<textarea name="ms" style=" height: 120px; width:60%; font-family:'Phetsarath OT'; font-size:18px;"></textarea><br><br>

</td>

</tr>  

</table></center>

<p style="font-family:'Phetsarath OT'; font-size:24px; color:#F00; margin-left:5%">III. ເລືອກກົດປຸ່ມສີແດງເພື່ອດໍາເນີນການປະເມີນອາຈານແຕ່ລະທ່ານ. (ອາຈານທ່ານໜຶ່ງຈະໄດ້ມີການປະເມີນພຽງຄັ້ງດຽວ)</p><br />

<div style="margin-left:10%;">

  <input type="text" class="opt2" style="width:10%;" name="" placeholder="" value="ລະຫັດວິຊາ">

  <input type="text" class="opt2" style="width:32%;" name="" placeholder="" value="ຊື່ລາຍວິຊາ">

  <input type="text" class="opt2" style="width:33%;" name="" placeholder="" value="ອາຈານສອນ">

  <input type="text" class="opt2" style="width:10%;" name="" placeholder="" value="ເລືອກບັນທຶກ"><br />

<?php

$sql3 = "Select * from subject where Year = 'ICT1_1' ";

$subject = $con->query($sql3);

$test = 0;

while($rs1 = $subject->fetch_assoc()){

$test++;

?>

    <input type="text" class="opt1" style="width:10%; text-align:center;" name="<?php echo $test.'t5' ;?>" placeholder="" value="<?php echo $rs1['ID']; ?>">

    <input type="text" class="opt1" style="width:32%;"name="<?php echo $test.'t6' ;?>" placeholder="" value="<?php echo $rs1['Name']; ?>">

    <input type="text" class="opt1" style="width:33%;"name="<?php echo $test.'t7' ;?>" placeholder="" value="<?php echo $rs1['Teacher']; ?>">

    <input type="submit" style=" background-color:#F00; width:10%; height:35px; font-family:'Saysettha OT'; font-size:18px; color:#FFF;" name="<?php echo $test.'t10' ;?>" id="t10" placeholder="" value="ບັນທຶກ" onClick="disable1()"><br />

<?php      

if(isset($_POST[$test.'t10'])){

    if(isset($_POST['ms'])){

$t33 = $_POST['ms'];

$t20 = $_POST[$test.'t5'];

$t21 = $_POST[$test.'t6'];

$t22 = $_POST[$test.'t7'];

$t23 = $_POST['t2'][0];

$t24 = $_POST['t2'][1];

$t25 = $_POST['t2'][2];

$t26 = $_POST['t2'][3];

$t27 = $_POST['t2'][4];

$t28 = $_POST['t2'][5];

$t29 = $_POST['t2'][6];

$t30 = $_POST['t2'][7];

$t31 = $_POST['t2'][8];

$t32 = $_POST['t2'][9];

//$t33 = $_POST['ms'];

//echo $t20, $t21, $t22, $t23, $t24, $t25, $t26, $t27, $t28, $t29, $t30, $t31, $t32;

$s6="insert into year1_1 (SubID, Name, Teacher, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Comment) values ('$t20', '$t21', '$t22', '$t23', '$t24', '$t25', '$t26', '$t27', '$t28', '$t29', '$t30', '$t31', '$t32', '$t33')";

 mysqli_query($con, $s6);  

}

}

}

?>

<br><br /><br /></div>


</form>

</div>

</body>

</html>

<?php   

include('footer.php');

?>