Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยแนะนำหน่อยครับ ระบบ e-lerning แบบแลือกรายวิชา พอดีที่ทำอยู่มันเป็นแบบวิชาเดียวครับ



 

ช่วยแนะนำหน่อยครับ ระบบ e-lerning แบบแลือกรายวิชา พอดีที่ทำอยู่มันเป็นแบบวิชาเดียวครับ

 



Topic : 124557



โพสกระทู้ ( 95 )
บทความ ( 0 )



สถานะออฟไลน์




รบกวนปรึกษา หรือช่วยแนะนำโค๊ดว่าต้องแก้ไขอย่างไหร ผมทำระบบ e-lerning มีโค๊ด First_test /end_test/login ในส่วนของ database จะมี Question,Answer และก็ Article ครับ แต่อยากให้มันมีตัวเลือกหลายวิชาให้ทำครับ ที่ทำอยู่มีแค่วิชาเดียว จะต้องเขียนโค๊ดเพิ่มตรงไหนบ้างครับ ช่วยแนะนำหน่อยครับกำลังสับสนครับ



Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, CakePHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2016-09-12 12:18:00 By : witsarut_bell View : 711 Reply : 2
 

 

No. 1



โพสกระทู้ ( 95 )
บทความ ( 0 )



สถานะออฟไลน์


Frist_test.php

Code (PHP)
<?php
	session_start();
	include ("admin/module/inc/php/config.inc.php");
	include ("admin/module/inc/php/function.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin/css/korea.css" rel="stylesheet" type="text/css" />
<title>E-Learning</title>
</head>
<script>
	function checkVal(){
		for(i=1;i<=10;i++){
			var rdo1=document.getElementById('Answer'+i+'_1').checked;
			var rdo2=document.getElementById('Answer'+i+'_2').checked;
			var rdo3=document.getElementById('Answer'+i+'_3').checked;
			var rdo4=document.getElementById('Answer'+i+'_4').checked;
			if(rdo1 == false && rdo2 == false && rdo3 == false && rdo4 == false){
				alert('คุณยังไม่ได้เลือกคำตอบที่ '+i);
				return false;
			}	
		}	
	}
</script>
<body>
<?php
	
	$selectPoint=select("member","Username='".$_SESSION['Username']."'");
	$Bypass=mysql_fetch_array($selectPoint);
	if($_SESSION['Username'] == ""){
		echo "<script>";
		echo "alert('กรุณาล๊อคอินเข้าสู่ระบบ');";
		echo "window.location='index.php';";
		echo "</script>";
	}else if($Bypass['FristPoint']!=0){
	
		$select=select("article","1=1 ORDER BY CreateDate DESC LIMIT 1");
		$art=mysql_fetch_array($select);
									
		echo "<script>";
		echo "alert('คุณได้ทำแบบทดสอบก่อนเรียนไปแล้ว');";
		echo "window.location='article.php?no=1&ArticleID=".$art['ArticleID']."';";
		echo "</script>";
	
	}else{
	$Act=$_GET['Act'];
	switch($Act){
		case 'checkPoint'	:	  $AnswerTrue=$_POST['hdAnswerTrue'];
									for($i=1;$i<=10;$i++){
										$Answer[]=$_POST['Answer'.$i];
									}
									
									$Point=0;
									for($i=0;$i<count($Answer);$i++){
										if($Answer[$i]==$AnswerTrue[$i]){
											$Point=$Point+1;
										}	
									}
									
									$FristTest=$Point;
									$update=update("member","FristPoint='".$Point."'","Username='".$_SESSION['Username']."'");
										
									$select=select("article","1=1 ORDER BY CreateDate DESC LIMIT 1");
									$art=mysql_fetch_array($select);
									
									echo "<script>";
									echo "alert('คุณได้คำแนนแบบทดสอบก่อนเรียน $Point คะแนน');";
									echo "window.location='article.php?no=1&ArticleID=".$art['ArticleID']."';";
									echo "</script>";
								  
		break;	
	}
?>
<div id="warp">
	<div id="login"><?php include("/login.php"); ?></div>
    <div id="clear"></div>
	<div id="header"></div>
    <div id="clear"></div>
    <div id="header-menu"><?php include("/top_menu.php"); ?></div>
    <div id="clear"></div>
    <div id="container">
    	<div id="container-left">
     	<form action="?Act=checkPoint" method="post">
        <table class="table-full margin">
          <tr>
            <td><div class="green">แบบทดสอบก่อนเรียน</div></td>
          </tr>
          <tr>
            <td>
            
			<?php
                $selectQue=select("question","1=1 ORDER BY rand() LIMIT 10");
                $no=0;
                while($que=mysql_fetch_array($selectQue)){
                    $no++;
            ?>
                <table class="table-full margin">
                  <tr>
                    <td width="17%" rowspan="2"><div class="no"><?=$no;?></div></td>
                    <td width="83%"><b>คำถาม :</b> <?php echo $que['Question']; ?><input type="hidden" name="hdAnswerTrue[]" value="<?=$que['AnswerTrue'];?>" /></td>
                  </tr>
                  <tr>
                    <td>
                    <?php
					$noA=0;
                    $selectAns=select("answer","QuestionID='".$que['QuestionID']."' ORDER BY rand()");
					while($ans=mysql_fetch_array($selectAns)){
						$noA++;
					?>
                    <b>คำตอบที่ <?=$noA;?></b><input type="radio" id="Answer<?=$no;?>_<?=$noA;?>" name="Answer<?=$no;?>" value="<?=$ans['Answer'];?>" /><?php echo $ans['Answer'];?><br>
                    <?php } ?>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="2"><div class="line"></div></td>
                  </tr>
                </table>
                <?php } ?>     
                      
            </td>
          </tr>
          <tr>
            <td><input type="submit" value="ส่งคำตอบ" onclick="return checkVal();" /></td>
          </tr>
        </table>
        </form>
    	</div>
        <div id="container-right">
 		<?php include ("menu.php"); ?>
        </div>
    </div>
    <div id="clear"></div>
    <div id="footer"></div>
</div>
<?php } ?>
</body>
</html>







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-09-12 12:18:45 By : witsarut_bell
 


 

No. 2



โพสกระทู้ ( 95 )
บทความ ( 0 )



สถานะออฟไลน์


end_test.php

Code (PHP)
<?php
	session_start();
	include ("admin/module/inc/php/config.inc.php");
	include ("admin/module/inc/php/function.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin/css/korea.css" rel="stylesheet" type="text/css" />
<title>E-Learning</title>
</head>
<script>
	function checkVal(){
		for(i=1;i<=20;i++){
			var rdo1=document.getElementById('Answer'+i+'_1').checked;
			var rdo2=document.getElementById('Answer'+i+'_2').checked;
			var rdo3=document.getElementById('Answer'+i+'_3').checked;
			var rdo4=document.getElementById('Answer'+i+'_4').checked;
			if(rdo1 == false && rdo2 == false && rdo3 == false && rdo4 == false){
				alert('คุณยังไม่ได้เลือกคำตอบที่ '+i);
				return false;
			}	
		}	
	}
</script>
<body>
<?php
	$selectPoint=select("member","Username='".$_SESSION['Username']."'");
	$Bypass=mysql_fetch_array($selectPoint);
	if($_SESSION['Username'] == ""){
		echo "<script>";
		echo "alert('กรุณาล๊อคอินเข้าสู่ระบบ');";
		echo "window.location='index.php';";
		echo "</script>";
	}else if($Bypass['FristPoint']==0){
		echo "<script>";
		echo "alert('กรุณาทำแบบทดสอบก่อนเรียนก่อนเรียน');";
		echo "window.location='frist_test.php';";
		echo "</script>";	
	}else{

	$Act=$_GET['Act'];
	switch($Act){
		case 'checkPoint'	:	  $AnswerTrue=$_POST['hdAnswerTrue'];
									for($i=1;$i<=20;$i++){
										$Answer[]=$_POST['Answer'.$i];
									}
									
									$Point=0;
									for($i=0;$i<count($Answer);$i++){
										if($Answer[$i]==$AnswerTrue[$i]){
											$Point=$Point+1;
										}	
									}
									
									$update=update("member","EndPoint='".$Point."'","Username='".$_SESSION['Username']."'");
									
									echo "<script>";
									echo "alert('คะแนนสอบหลังเรียน $Point เต็ม 20');";
									echo "window.location='ranking.php';";
									echo "</script>";
								  
		break;	
	}
?>
<div id="warp">
	<div id="login"><?php include("/login.php"); ?></div>
    <div id="clear"></div>
	<div id="header"></div>
    <div id="clear"></div>
    <div id="header-menu"><?php include("/top_menu.php"); ?></div>
    <div id="clear"></div>
    <div id="container">
    	<div id="container-left">
     	<form action="?Act=checkPoint" method="post">
        <table class="table-full margin">
          <tr>
            <td><div class="green">แบบทดสอบหลังเรียน</div></td>
          </tr>
          <tr>
            <td>
            
				 <?php
                $selectQue=select("question","1=1 ORDER BY rand() LIMIT 20");
                $no=0;
                while($que=mysql_fetch_array($selectQue)){
                    $no++;
                ?>
                <table class="table-full margin">
                  <tr>
                    <td width="17%" rowspan="2"><div class="no"><?=$no;?></div></td>
                    <td width="83%"><b>คำถาม :</b> <?php echo $que['Question']; ?><input type="hidden" name="hdAnswerTrue[]" value="<?=$que['AnswerTrue'];?>" /></td>
                  </tr>
                  <tr>
                    <td>
                    <?php
					$noA=0;
                    $selectAns=select("answer","QuestionID='".$que['QuestionID']."' ORDER BY rand()");
					while($ans=mysql_fetch_array($selectAns)){
						$noA++;
					?>
                    <b>คำตอบที่ <?=$noA;?></b><input type="radio" id="Answer<?=$no;?>_<?=$noA;?>" name="Answer<?=$no;?>" value="<?=$ans['Answer'];?>" /><?php echo $ans['Answer'];?><br>
                    <?php } ?>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="2"><div class="line"></div></td>
                  </tr>
                </table>
                <?php } ?>     
                      
            </td>
          </tr>
          <tr>
            <td><input type="submit" value="ส่งคำตอบ" onclick="return checkVal();" /></td>
          </tr>
        </table>
        </form>
    	</div>
        <div id="container-right">
 		<?php include ("menu.php"); ?>
        </div>
    </div>
    <div id="clear"></div>
    <div id="footer"></div>
</div>
<?php } ?>
</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-09-12 12:19:26 By : witsarut_bell
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยแนะนำหน่อยครับ ระบบ e-lerning แบบแลือกรายวิชา พอดีที่ทำอยู่มันเป็นแบบวิชาเดียวครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่