<?php session_start(); include("../config.php"); $pre_id = null; if(isset($_GET["pre_id"])) { $pre_id = $_GET["pre_id"]; } ?> <html> <head> <meta charset="UTF-8"> <title>Local History Southern Thailand </title> <link rel="stylesheet" href="css/s-index.css"> </head> <body> <div> <h1>แก้ไขแบบทดสอบก่อนเรียน</h1> <?php $sqli = "SELECT * FROM tb_pretest WHERE pre_id = '".$pre_id."' "; $result = mysqli_query($con,$sqli); $row = mysqli_fetch_array($result); ?> <form action="save_pretest.php" method="post" name="edit_pre" > <table> <tr> <td width="100">ระดับ</td> <td width="500"> <input type="text" name="txtlevel" value="<?php echo $row["pre_levels"] ?>" readonly> <a href="edit_level.php?pre_id=<?php echo $row["pre_id"]?>"><input type="button" name="but_lev" value="CHANGE LEVELS"></a> </td> </tr> <tr> <td width="100">บทเรียน</td> <td width="500"> <input type="text" name="txtlosson" value="<?php echo $row["pre_lesson"] ?>" readonly> <a href="edit_lesson.php?pre_id=<?php echo $row["pre_id"]?>"><input type="button" name="but_lev" value="CHANGE LESSON"></a> </td> </tr> <tr> <td width="300">รหัสแบบฝึกหัดก่อนเรียน</td> <td width="300"><input type=text name=idpre value="<?php echo $row["pre_id"];?>" readonly></td> </tr> <tr> <td width="100">โจทย์</td> <td width="300"><input type=text name=subject value="<?php echo $row["pre_subject"];?>"></td> </tr> <tr> <td width="100">ตัวเลือกที่ 1</td> <td width="300"><input type=text name=choice1 value="<?php echo $row["pre_choice1"];?>"></td> </tr> <tr> <td width="100">ตัวเลือกที่ 2</td> <td width="300"><input type=text name=choice2 value="<?php echo $row["pre_choice2"];?>"></td> </tr> <tr> <td width="100">ตัวเลือกที่ 3</td> <td width="300"><input type=text name=choice3 value="<?php echo $row["pre_choice3"];?>"></td> </tr> <tr> <td width="100">ตัวเลือกที่ 4</td> <td width="300"><input type=text name=choice4 value="<?php echo $row["pre_choice4"];?>"></td> </tr> </table><br> <a href="../teacher/index_teacher.php"><input type="button" value="BACK"></a> <input type="submit" name="submit" value="UPDATE"> </form> </div> <br> </body> </html>
<?php session_start(); include("../config.php"); $pre_id = null; if(isset($_GET["pre_id"])) { $pre_id = $_GET["pre_id"]; } $sqli3 = "SELECT * FROM tb_pretest WHERE pre_id = '".$pre_id."' "; $result3 = mysqli_query($con,$sqli3); $row3 = mysqli_fetch_array($result3); $sqli2="SELECT * FROM tb_pretest"; $result2 = mysqli_query($con,$sqli2); $row2 = mysqli_fetch_array($result2) ?> <html> <head> <meta charset="UTF-8"> <title>Local History Southern Thailand </title> <link rel="stylesheet" href="css/s-index.css"> </head> <body> <div> <h1>แก้ไขระดับ</h1> <form action="save_levels.php" method="post" name="edit_pre" > <table> <tr> <td width="100">ระดับ</td> <td width="300"> <input type="text" name="idpre" value="<?php echo $row2["pre_id"];?>" readonly> <select name="select_levels"> <?php $sqli="SELECT * FROM tb_levels order by lev_id ASC"; $result = mysqli_query($con,$sqli); while($row = mysqli_fetch_array($result)){ ?> <option value=" <?php echo $row["lev_name"];?>"> <?php echo $row["lev_name"];?> </option> <?php } ?> </select> </td> </tr> </table><br> <a href=javascript:history.back(1)><input type="button" value="BACK"></a> <input type="submit" name="submit" value="UPDATE"> </form> </div> <br> </body> </html>
<?php session_start(); include("../config.php"); $pre_id=$_GET[pre_id]; $pre_levels = $_GET[pre_levels]; ?> <?php $sql = "UPDATE tb_pretest SET pre_levels = '".$_POST["select_levels"]."' WHERE pre_id = '".$_POST["idpre"]."' "; $query = mysqli_query($con,$sql); if($query) { echo "<script>alert(\" update successfully\");</script>"; echo "<script> window.location='edit_pretest.php?pre_id' </script>"; } ?>
header('location: url_สำหรับ_edit_พร้อม_parameter_เลียนแบบการแก้ไข');
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง