|
|
|
สอบถามปัญหาเรื่องตัวแปรที่ใช้หรือการดึงค่าของตัวแปรมาใช้ |
|
|
|
|
|
|
|
ก็ตัวแปร $_GET['ck']
ไม่ได้ประกาศไว้น่ะสิคับ ลองดูตรง ต่อท้าย url สิครับ ว่ามี ?ck=
หรือเปล่า
|
|
|
|
|
Date :
2012-07-30 08:57:46 |
By :
ichiko |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่มีครับจะขึ้นแบบนี้ครับ
อันนี้คือ code หน้านี้ครับ
<? session_start(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<? require_once('Connections/db_connect.php'); ?>
<?php
//mysql_select_db($database_db_connect, $db_connect);
if (!isset($_SESSION['MEM_USER'])) { $MEM_USER = ""; } else { $MEM_USER = $_SESSION['MEM_USER']; }
if (!isset($_SESSION['MEM_PASS'])) { $MEM_PASS = ""; } else { $MEM_PASS = $_SESSION['MEM_PASS']; }
if (!isset($HTTP_POST_VARS['send'])) { $send = ""; } else { $send = $HTTP_POST_VARS['send']; }
if (!isset($HTTP_POST_VARS['item1'])) { $item1= ""; } else { $item1 = $HTTP_POST_VARS['item1']; }
if (!isset($HTTP_POST_VARS['item2'])) { $item2= ""; } else { $item2 = $HTTP_POST_VARS['item2']; }
if (!isset($HTTP_POST_VARS['item3'])) { $item3= ""; } else { $item3 = $HTTP_POST_VARS['item3']; }
if (!isset($HTTP_POST_VARS['item4'])) { $item4= ""; } else { $item4 = $HTTP_POST_VARS['item4']; }
if (!isset($HTTP_POST_VARS['item5'])) { $item5= ""; } else { $item5 = $HTTP_POST_VARS['item5']; }
if (!isset($HTTP_POST_VARS['item6'])) { $item6= ""; } else { $item6 = $HTTP_POST_VARS['item6']; }
if (!isset($HTTP_POST_VARS['item7'])) { $item7= ""; } else { $item7 = $HTTP_POST_VARS['item7']; }
if (!isset($HTTP_POST_VARS['item8'])) { $item8= ""; } else { $item8 = $HTTP_POST_VARS['item8']; }
if (!isset($HTTP_POST_VARS['item9'])) { $item9= ""; } else { $item9 = $HTTP_POST_VARS['item9']; }
if (!isset($HTTP_POST_VARS['item10'])) { $item10= ""; } else { $item10 = $HTTP_POST_VARS['item10']; }
if (!isset($HTTP_POST_VARS['item11'])) { $item11= ""; } else { $item11 = $HTTP_POST_VARS['item11']; }
if (!isset($HTTP_POST_VARS['item12'])) { $item12= ""; } else { $item12 = $HTTP_POST_VARS['item12']; }
if (!isset($HTTP_POST_VARS['item13'])) { $item13= ""; } else { $item13 = $HTTP_POST_VARS['item13']; }
if (!isset($HTTP_POST_VARS['item14'])) { $item14= ""; } else { $item14 = $HTTP_POST_VARS['item14']; }
if (!isset($HTTP_POST_VARS['item15'])) { $item15= ""; } else { $item15 = $HTTP_POST_VARS['item15']; }
if (!isset($HTTP_POST_VARS['item16'])) { $item16= ""; } else { $item16 = $HTTP_POST_VARS['item16']; }
if (!isset($HTTP_POST_VARS['item17'])) { $item17= ""; } else { $item17 = $HTTP_POST_VARS['item17']; }
if (!isset($HTTP_POST_VARS['item18'])) { $item18= ""; } else { $item18= $HTTP_POST_VARS['item18']; }
if (!isset($HTTP_POST_VARS['item19'])) { $item19= ""; } else { $item19 = $HTTP_POST_VARS['item19']; }
if (!isset($HTTP_POST_VARS['item20'])) { $item20= ""; } else { $item20 = $HTTP_POST_VARS['item20']; }
mysql_query("SET NAMES TIS620");
$query_singin = "SELECT * FROM member WHERE member.MEM_USER='$MEM_USER'";
$singin = mysql_query($query_singin);
$totalRows_singin = mysql_num_rows($singin);
if($totalRows_singin==0) { header("location:index.php"); }
$row_singin = mysql_fetch_assoc($singin);
//if($row_singin['mem_pretest_value']!=0)
//header("location:chap_1.php");
?>
<?php
$maxRows_exam1 = 20;
$pageNum_exam1 = 0;
if (isset($_GET['pageNum_exam1'])) {
$pageNum_exam1 = $_GET['pageNum_exam1'];
}
$startRow_exam1 = $pageNum_exam1 * $maxRows_exam1;
//mysql_select_db($database_db_connect, $db_connect);
$query_exam1 = "SELECT * FROM test_less4 where no='19' order by rand()";
$query_limit_exam1 = sprintf("%s LIMIT %d, %d", $query_exam1, $startRow_exam1, $maxRows_exam1);
$exam1 = mysql_query($query_limit_exam1);
$row_exam1 = mysql_fetch_assoc($exam1);
if (isset($_GET['totalRows_exam1'])) {
$totalRows_exam1 = $_GET['totalRows_exam1'];
} else {
$all_exam1 = mysql_query($query_exam1);
$totalRows_exam1 = mysql_num_rows($all_exam1);
}
$totalPages_exam1 = ceil($totalRows_exam1/$maxRows_exam1)-1;
?>
<?
/*if($send) {
//ข้อ 1
if(is_array($item1)) {
foreach($item1 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 2
if(is_array($item2)) {
foreach($item2 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 3
if(is_array($item3)) {
foreach($item3 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 4
if(is_array($item4)) {
foreach($item4 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ5
if(is_array($item5)) {
foreach($item5 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 6
if(is_array($item6)) {
foreach($item6 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 7
if(is_array($item7)) {
foreach($item7 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 8
if(is_array($item8)) {
foreach($item8 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 9
if(is_array($item9)) {
foreach($item9 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 10
if(is_array($item10)) {
foreach($item10 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 11
if(is_array($item11)) {
foreach($item11 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 1
if(is_array($item12)) {
foreach($item12 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 1
if(is_array($item13)) {
foreach($item13 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 1
if(is_array($item14)) {
foreach($item14 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 15
if(is_array($item15)) {
foreach($item15 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 16
if(is_array($item16)) {
foreach($item16 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 17
if(is_array($item17)) {
foreach($item17 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ข้อ 18
if(is_array($item18)) {
foreach($item18 as $val){
$a=substr($val,0,1);
$b=substr($val,1);
$sql="select * from pretest where id='$b' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if($row['answer']==$a) {
$sql=" update member set mem_pretest_value=mem_pretest_value+1 where (MEM_USER='$MEM_USER' and MEM_PASS='$MEM_PASS') ";
$result=mysql_query($sql);
}
}
}
//ถ้าทำครบแล้ว
//header("location:showtotal.php?test=1");
}*/
?>
<html>
<style type="text/css">
<!--
.style7 {
font-size: 24px;
color: #0000FF;
font-weight: bold;
}
-->
</style>
<head>
<title>O N L I N E C O U R S E :: unlimite learning your self online 24 hr.</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
@import url("mystyle.css");
-->
</style>
<link href="mystyle.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript" src="javascript/jquery-1.4.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$('#send').click(function(){
var n = 20;//$('#cQuestion').val();
var x = 0;
$('#form1 :radio').each(function(i){
//var valName="input[name=item"+i+"]:checked";
// var x=$(valName).val();
// alert(i+">>"+x);
//alert(i);
//alert($('#form1 :radio:checked').val());
var $radios = $('input:radio[name=item'+i+']');
//var $radios = $(valName);
if($radios.is(':checked') === true) {
// $radios.filter('[value=Male]').attr('checked', true);
//alert(i);
x++;
}
});
if (x==n){
$('#form1').submit();
}else{
alert("ยังทำข้อสอบไม่ครบ !!");
}
});
});
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.style5 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" width="780">
<!-- fwtable fwsrc="Untitled" fwbase="menu_top.gif" fwstyle="Dreamweaver" fwdocid = "1053233141" fwnested="0" -->
<tr>
<td><img src="img/bansucess.jpg" width="979" height="200">
<TABLE height=21 cellSpacing=1 cellPadding=0 width="981" bgColor=#FFFFFF border=0>
<!-- จบการเปลี่ยนแปลง -->
<TBODY>
<TR bgColor=#000000>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#6600FF');" onmouseout=mOut(this);><a href="index.php"><strong>home</strong></a></TD>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#CC99FF');" onmouseout=mOut(this);><a href="descript.php"><strong>คำอธิบายรายวิชา</strong></a></TD>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#6699FF');" onmouseout=mOut(this);><a href="courseplan.php"><strong>แผนการเรียน</strong></a></TD>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#81A765');" onmouseout=mOut(this);><a href="aboutus.php"><strong>ผู้จัดทำ</strong></a></TD>
<TD width=163 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#0000FF');" onmouseout=mOut(this);><a href="student.php"><strong>นักเรียนเข้าสู่บทเรียน</strong></a></TD>
<TD width=171 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#C0C088');" onmouseout=mOut(this);><a href="admin/index.php"><strong>Admin</strong></a> <a class="toolLnk" href="indexstudent.php"></a></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" valign="top" background="images/bg_b.gif"><table width="218" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/bg_b.gif"><?
$foo = include 'leftmenu.php';
?></td>
</tr>
</table></td>
<td><img src="images/box_1.gif" width="9" height="9"></td>
<td width="80%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/box_1.gif" width="9" height="9"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<? if ($_GET['cK']=='19'){?>
<tr>
<td width="60%" valign="top" ><p align="center" class="style5"> </p>
<p align="center" class="style7">แบบทดสอบหลังเรียน</p> </td>
</tr>
<tr>
<td valign="top" >
<form method="post" name="form1" id="form1" action="showtotal.php" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php $no=0;
do {
?>
<tr>
<td>ข้อที่ <? print $no+1; ?> <?php echo $row_exam1['question']; ?><input name="id[]" type="hidden" value="<?=$row_exam1['id']?>"><input name="answer[]" type="hidden" value="<?=$row_exam1['answer']?>"><input name="test" type="hidden" value="1"></td>
</tr>
<tr>
<td> <input id="item<?=$no?>" name="item<?=$no?>" type="radio" value="1" />
<?php echo $row_exam1['c1']; ?></td>
</tr>
<tr>
<td> <input id="item<?=$no?>" name="item<?=$no?>" type="radio" value="2" />
<?php echo $row_exam1['c2']; ?></td>
</tr>
<tr>
<td>
<input id="item<?=$no?>" name="item<?=$no; ?>" type="radio" value="3" />
<?php echo $row_exam1['c3']; ?></td>
</tr>
<tr>
<td> <input id="item<?=$no?>" name="item<?=$no?>" type="radio" value="4" />
<?php echo $row_exam1['c4']; ?></td>
</tr>
<tr>
<td> </td>
</tr>
<?php
$no++;
} while ($row_exam1 = mysql_fetch_assoc($exam1)); ?>
<tr>
<td height="34" align="center"><input name="send" type="button" id="send" value="ส่งข้อสอบ"></td>
</tr>
</table>
</form> <? }//end if ?> </td>
</tr>
</table> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($exam1);
?>
|
|
|
|
|
Date :
2012-07-30 09:31:57 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|