PHP Ionic Angularjs Phonegap AJAX Javascript CSS MySQL jQuery Forum

สอบถามเรื่องการ Checkbox ตรวจสอบค่าที่ส่งไปแต่ละหน้าครับ

สอบถามเรื่องการ Checkbox ตรวจสอบค่าที่ส่งไปแต่ละหน้าครับ

Code หน้าแรกนะครับ

 เป็นหน้า home หน้านี้ลงฐานข้อมูลด้วยครับ

หน้านี้มี Function ของ Jquery ด้วยครับ โดยการ ติ๊กที่ checkbox แล้วไห้ radio disbled

 

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="email1.php">
<table width="876" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="30" colspan="2" valign="top">4.1 Email 1</td>
    <td width="30" valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second');" id="checkbox1"></td>
    <td width="262" valign="center"><input type="radio" name="radio" class="second" id="radio" value="radio" />
      <input type="radio" name="radio" class="second" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second" id="radio10" value="radio" /></td>
    <td width="115">&nbsp;</td>
    <td width="339">&nbsp;</td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.2 Email 2</td>
   <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second2');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio" class="second2" id="radio" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second2" id="radio10" value="radio" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.3 Email 3</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second3');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio" class="second3" id="radio" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second3" id="radio10" value="radio" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.4 Email 4</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second4');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio" class="second4" id="radio" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second4" id="radio10" value="radio" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.5 Email 5</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second5');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio" class="second5" id="radio" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second5" id="radio10" value="radio" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.6 Email 6</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second6');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio" class="second6" id="radio" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second6" id="radio10" value="radio" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.7 Email 7</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second7');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio" class="second7" id="radio" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio2" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio3" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio4" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio5" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio6" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio7" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio8" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio9" value="radio" />
      <input type="radio" name="radio" class="second7" id="radio10" value="radio" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="47" colspan="5" valign="top"><p>เมื่อ Click ที่ Email นั้นๆ จะไม่สามารถทำหน้านั้นได้แต่หน้าอื่นสามารถทำได้    </p>
      <p>&nbsp;</p></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="113" height="38" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      <label></label></td>
    <td width="17">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="210">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
 
<script src="js/jquery-1.8.3.min.js"></script>  
 
<script type="text/javascript">
    $(document).ready(function () {
        
 
        
    });
    var setCheck = function(chkObj,cssObj){
        var i_check=$(chkObj).prop("checked");
        if(i_check==true){
            $("."+cssObj).prop("checked",false).attr('disabled', true);
        }else{
            $("."+cssObj).attr('disabled', false);
        }
    };    
 
</script>
 
 
</body>
</html>


หน้าที่ 1 คือ email 1

 

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail1.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 1 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>

Save ที่หน้า 1
 
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email2.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E1)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>
 




หน้าที่ 2 คือ email 2
<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail2.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 2 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
 
Save ที่หน้า 2
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email3.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E2)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>
 

หน้าที่ 3 คือ email 3
<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail3.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 3 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
 
Save ที่หน้า 3
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email4.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E3)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>
 

 

หน้าที่ 4 คือ email 4

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail4.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 4 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
 

Save ที่หน้า 4

<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email5.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E4)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>
 

 

 

หน้าที่ 5 คือ email 5

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail5.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 5 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
 

Save ที่หน้า 5

<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email6.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E5)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>

 

 

หน้าที่ 6 คือ email 6

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail6.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 6 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
 

Save ที่หน้า 6

<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email7.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E6)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>
 




หน้าที่ 7 คือ email 7

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="saveemail7.php">
<table width="404" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="133" height="28" valign="top">Email 7 ดีเท่าไหร่</td>
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" /></td>
  </tr>
  <tr>
    <td height="36" colspan="2" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      
     
    </td>
  </tr>
  <tr>
    <td height="65">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
 

Save ที่หน้า 7

<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=home.php'>
 
 
 
<?
 
include ('connect.php');
 
 
 
 
 
$sql = "insert into email1 (E7)
VALUES ('$_POST[radio]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>



ผมอยากจะถามว่า ถ้าผมคลิ๊กที่ Email 1 ในหน้า home พอผมบันทึกลงฐานข้อมูลเสร็จผมจะไม่สามารถทำหน้า Email1 ได้เลยครับ แต่สามารถทำ Email 2-7 ได้ เพราะผมไม่ได้ ติ๊ก 

และถ้าผม ติ๊ก Email2 กับ Email7 ผมก้อสามารถทำหน้า Email1 Email3 และ Email4 Email5 Email6 ได้ครับ แนวนี้

 

ผมตันอยู่หลายวันเลยครับ ไม่รุ้จะไช้วิธีไหน มือใหม่นะครับ รบบกวนด้วยครับผม



โดย:  Hanakobz112 IP: 202.183.201.xxx วันที่: 08-10-2014 เวลา: 10:54:22

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ


  • ( หรือ สามารถทำการ สมัครสมาชิก และล็อกอิน ด้วย ปุ่ม Log in with Facebook ด้านล่าง )
 ความคิดเห็นที่ 4

ผมลองแล้วอะครับ พี่ นิก

 มีตัวอย่างแบบ ง่ายกว่านี้ไหม่ครับ ผมทำแบบแยกหน้าอะครับ เลยไม่รุ้จาไส่ยังไง พอ save ข้อมูลเสร็จ เหมือนมัน
ไม่สามารถส่งค่าไปได้ครับ


step เหมือนด้านบน เลยครับแต่ที่เพิ่มมา คือ




อันนี้คือหน้าแรกของแต่ละแผนกว่า ไม่ได้ใช้ข้ออะไรบ้าง
 

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="1save.php">
  <p>
    <input type="checkbox" name="checkbox" id="checkbox" />
  แผนก1(ไม่ได้ทำข้อที่ 2 3 4)</p>
  <p>
    <input type="checkbox" name="checkbox2" id="checkbox2" />
  แผนก2 (ไม่ได้ทำข้อที่ 1 3 4)</p>
  <p>
    <input type="checkbox" name="checkbox3" id="checkbox3" />
  แผนก3  (ไม่ได้ทำข้อที่ 2 3 4 5 6)</p>
  <p>
    <input type="checkbox" name="checkbox4" id="checkbox4" />
  แผนก4  (ไม่ได้ทำข้อที่ 6 7 8 9)</p>
  <p>
    <input type="checkbox" name="checkbox5" id="checkbox5" />
แผนก5  (ไม่ได้ทำข้อที่ 2  4 5)</p>
  <p>
    <input type="submit" name="button" id="button" value="Submit" />
  </p>
</form>
</body>
</html>

 



และหน้า save ของแต่ละหน้าจะเป็นประมานนี้ครับ คือมีการตั้ง ใน Refresh ไปอีกหน้า

 
<!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" />
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=2.php'>
<title>Untitled Document</title>
</head>
 
<body>
</body>
</html>



ส่วนหน้าที่ 2 นี้ มาจากหน้าแรกครับ ที่แต่ละแผนกไม่ได้ใช้อะไรบ้างให้ Disbled เลย



<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="2save.php">
  <p>
    <input type="checkbox" name="checkbox" id="checkbox" /> 
    1
    <input type="radio" name="radio" id="radio" value="radio" />
    <input type="radio" name="radio" id="radio2" value="radio" />
    <input type="radio" name="radio" id="radio3" value="radio" />
    <input type="radio" name="radio" id="radio4" value="radio" />
    <input type="radio" name="radio" id="radio5" value="radio" />
    <input type="radio" name="radio" id="radio6" value="radio" />
    <input type="radio" name="radio" id="radio7" value="radio" />
    <input type="radio" name="radio" id="radio8" value="radio" />
    <input type="radio" name="radio" id="radio9" value="radio" />
    <input type="radio" name="radio" id="radio10" value="radio" />
    Page
  4.1</p>
  <p>
    <input type="checkbox" name="checkbox2" id="checkbox2" />
  2
  <input type="radio" name="radio" id="radio11" value="radio" />
  <input type="radio" name="radio" id="radio12" value="radio" />
  <input type="radio" name="radio" id="radio13" value="radio" />
  <input type="radio" name="radio" id="radio14" value="radio" />
  <input type="radio" name="radio" id="radio15" value="radio" />
  <input type="radio" name="radio" id="radio16" value="radio" />
  <input type="radio" name="radio" id="radio17" value="radio" />
  <input type="radio" name="radio" id="radio18" value="radio" />
  <input type="radio" name="radio" id="radio19" value="radio" />
  <input type="radio" name="radio" id="radio20" value="radio" />
  Page 4.2</p>
  <p>
    <input type="checkbox" name="checkbox3" id="checkbox3" />
  3
  <input type="radio" name="radio" id="radio21" value="radio" />
  <input type="radio" name="radio" id="radio22" value="radio" />
  <input type="radio" name="radio" id="radio23" value="radio" />
  <input type="radio" name="radio" id="radio24" value="radio" />
  <input type="radio" name="radio" id="radio25" value="radio" />
  <input type="radio" name="radio" id="radio26" value="radio" />
  <input type="radio" name="radio" id="radio27" value="radio" />
  <input type="radio" name="radio" id="radio28" value="radio" />
  <input type="radio" name="radio" id="radio29" value="radio" />
  <input type="radio" name="radio" id="radio30" value="radio" />
  Page 4.3</p>
  <p>
    <input type="checkbox" name="checkbox4" id="checkbox4" />
  4
  <input type="radio" name="radio" id="radio31" value="radio" />
  <input type="radio" name="radio" id="radio32" value="radio" />
  <input type="radio" name="radio" id="radio33" value="radio" />
  <input type="radio" name="radio" id="radio34" value="radio" />
  <input type="radio" name="radio" id="radio35" value="radio" />
  <input type="radio" name="radio" id="radio36" value="radio" />
  <input type="radio" name="radio" id="radio37" value="radio" />
  <input type="radio" name="radio" id="radio38" value="radio" />
  <input type="radio" name="radio" id="radio39" value="radio" />
  <input type="radio" name="radio" id="radio40" value="radio" />
  Page 4.4</p>
  <p>
    <input type="checkbox" name="checkbox5" id="checkbox5" /> 
    5
    <input type="radio" name="radio" id="radio41" value="radio" />
    <input type="radio" name="radio" id="radio42" value="radio" />
    <input type="radio" name="radio" id="radio43" value="radio" />
    <input type="radio" name="radio" id="radio44" value="radio" />
    <input type="radio" name="radio" id="radio45" value="radio" />
    <input type="radio" name="radio" id="radio46" value="radio" />
    <input type="radio" name="radio" id="radio47" value="radio" />
    <input type="radio" name="radio" id="radio48" value="radio" />
    <input type="radio" name="radio" id="radio49" value="radio" />
    <input type="radio" name="radio" id="radio50" value="radio" />
  Page 4.5</p>
  <p>
    <input type="checkbox" name="checkbox6" id="checkbox6" />
  6
  <input type="radio" name="radio" id="radio51" value="radio" />
  <input type="radio" name="radio" id="radio52" value="radio" />
  <input type="radio" name="radio" id="radio53" value="radio" />
  <input type="radio" name="radio" id="radio54" value="radio" />
  <input type="radio" name="radio" id="radio55" value="radio" />
  <input type="radio" name="radio" id="radio56" value="radio" />
  <input type="radio" name="radio" id="radio57" value="radio" />
  <input type="radio" name="radio" id="radio58" value="radio" />
  <input type="radio" name="radio" id="radio59" value="radio" />
  <input type="radio" name="radio" id="radio60" value="radio" />
  Page 4.6</p>
  <p>
    <input type="checkbox" name="checkbox7" id="checkbox7" />
  7
  <input type="radio" name="radio" id="radio61" value="radio" />
  <input type="radio" name="radio" id="radio62" value="radio" />
  <input type="radio" name="radio" id="radio63" value="radio" />
  <input type="radio" name="radio" id="radio64" value="radio" />
  <input type="radio" name="radio" id="radio65" value="radio" />
  <input type="radio" name="radio" id="radio66" value="radio" />
  <input type="radio" name="radio" id="radio67" value="radio" />
  <input type="radio" name="radio" id="radio68" value="radio" />
  <input type="radio" name="radio" id="radio69" value="radio" />
  <input type="radio" name="radio" id="radio70" value="radio" />
  Page 4.7</p>
  <p>
    <input type="checkbox" name="checkbox8" id="checkbox8" />
  8
  <input type="radio" name="radio" id="radio71" value="radio" />
  <input type="radio" name="radio" id="radio72" value="radio" />
  <input type="radio" name="radio" id="radio73" value="radio" />
  <input type="radio" name="radio" id="radio74" value="radio" />
  <input type="radio" name="radio" id="radio75" value="radio" />
  <input type="radio" name="radio" id="radio76" value="radio" />
  <input type="radio" name="radio" id="radio77" value="radio" />
  <input type="radio" name="radio" id="radio78" value="radio" />
  <input type="radio" name="radio" id="radio79" value="radio" />
  <input type="radio" name="radio" id="radio80" value="radio" />
  </p>
  <p>
    <input type="checkbox" name="checkbox9" id="checkbox9" /> 
    9
    <input type="radio" name="radio" id="radio81" value="radio" />
    <input type="radio" name="radio" id="radio82" value="radio" />
    <input type="radio" name="radio" id="radio83" value="radio" />
    <input type="radio" name="radio" id="radio84" value="radio" />
    <input type="radio" name="radio" id="radio85" value="radio" />
    <input type="radio" name="radio" id="radio86" value="radio" />
    <input type="radio" name="radio" id="radio87" value="radio" />
    <input type="radio" name="radio" id="radio88" value="radio" />
    <input type="radio" name="radio" id="radio89" value="radio" />
    <input type="radio" name="radio" id="radio90" value="radio" />
  </p>
  <p>
    <input type="checkbox" name="checkbox10" id="checkbox10" />
  10
  <input type="radio" name="radio" id="radio91" value="radio" />
  <input type="radio" name="radio" id="radio92" value="radio" />
  <input type="radio" name="radio" id="radio93" value="radio" />
  <input type="radio" name="radio" id="radio94" value="radio" />
  <input type="radio" name="radio" id="radio95" value="radio" />
  <input type="radio" name="radio" id="radio96" value="radio" />
  <input type="radio" name="radio" id="radio97" value="radio" />
  <input type="radio" name="radio" id="radio98" value="radio" />
  <input type="radio" name="radio" id="radio99" value="radio" />
  <input type="radio" name="radio" id="radio100" value="radio" />
  </p>
  <p>อันไหนที่หน้านี้ Disbled หน้าที่ 3 ต้อง Disbled ด้วย</p>
  <p>
    <input type="submit" name="button" id="button" value="Submit" />
  </p>
</form>
</body>
</html>


save หน้า 2


<!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" />
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=3.php'>
<title>Untitled Document</title>
</head>
 
<body>
</body>
</html>






ส่วนหน้าที่ 3 ก็เหมือนหน้าที่ 2 คือ หน้าที่ 2 Disbled ยังไง ก็แบบนั้นครับ


<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="2save.php">
  <p>
    <input type="checkbox" name="checkbox" id="checkbox" /> 
    1
    <input type="radio" name="radio" id="radio" value="radio" />
    <input type="radio" name="radio" id="radio2" value="radio" />
    <input type="radio" name="radio" id="radio3" value="radio" />
    <input type="radio" name="radio" id="radio4" value="radio" />
    <input type="radio" name="radio" id="radio5" value="radio" />
    <input type="radio" name="radio" id="radio6" value="radio" />
    <input type="radio" name="radio" id="radio7" value="radio" />
    <input type="radio" name="radio" id="radio8" value="radio" />
    <input type="radio" name="radio" id="radio9" value="radio" />
    <input type="radio" name="radio" id="radio10" value="radio" />
  Page
  4.1</p>
  <p>
    <input type="checkbox" name="checkbox2" id="checkbox2" />
  2
  <input type="radio" name="radio" id="radio11" value="radio" />
  <input type="radio" name="radio" id="radio12" value="radio" />
  <input type="radio" name="radio" id="radio13" value="radio" />
  <input type="radio" name="radio" id="radio14" value="radio" />
  <input type="radio" name="radio" id="radio15" value="radio" />
  <input type="radio" name="radio" id="radio16" value="radio" />
  <input type="radio" name="radio" id="radio17" value="radio" />
  <input type="radio" name="radio" id="radio18" value="radio" />
  <input type="radio" name="radio" id="radio19" value="radio" />
  <input type="radio" name="radio" id="radio20" value="radio" />
  Page
  4.2</p>
  <p>
    <input type="checkbox" name="checkbox3" id="checkbox3" />
  3
  <input type="radio" name="radio" id="radio21" value="radio" />
  <input type="radio" name="radio" id="radio22" value="radio" />
  <input type="radio" name="radio" id="radio23" value="radio" />
  <input type="radio" name="radio" id="radio24" value="radio" />
  <input type="radio" name="radio" id="radio25" value="radio" />
  <input type="radio" name="radio" id="radio26" value="radio" />
  <input type="radio" name="radio" id="radio27" value="radio" />
  <input type="radio" name="radio" id="radio28" value="radio" />
  <input type="radio" name="radio" id="radio29" value="radio" />
  <input type="radio" name="radio" id="radio30" value="radio" />
  Page
  4.3</p>
  <p>
    <input type="checkbox" name="checkbox4" id="checkbox4" />
  4
  <input type="radio" name="radio" id="radio31" value="radio" />
  <input type="radio" name="radio" id="radio32" value="radio" />
  <input type="radio" name="radio" id="radio33" value="radio" />
  <input type="radio" name="radio" id="radio34" value="radio" />
  <input type="radio" name="radio" id="radio35" value="radio" />
  <input type="radio" name="radio" id="radio36" value="radio" />
  <input type="radio" name="radio" id="radio37" value="radio" />
  <input type="radio" name="radio" id="radio38" value="radio" />
  <input type="radio" name="radio" id="radio39" value="radio" />
  <input type="radio" name="radio" id="radio40" value="radio" />
  Page
  4.4</p>
  <p>
    <input type="checkbox" name="checkbox5" id="checkbox5" /> 
    5
    <input type="radio" name="radio" id="radio41" value="radio" />
    <input type="radio" name="radio" id="radio42" value="radio" />
    <input type="radio" name="radio" id="radio43" value="radio" />
    <input type="radio" name="radio" id="radio44" value="radio" />
    <input type="radio" name="radio" id="radio45" value="radio" />
    <input type="radio" name="radio" id="radio46" value="radio" />
    <input type="radio" name="radio" id="radio47" value="radio" />
    <input type="radio" name="radio" id="radio48" value="radio" />
    <input type="radio" name="radio" id="radio49" value="radio" />
    <input type="radio" name="radio" id="radio50" value="radio" />
  Page
  4.5</p>
  <p>
    <input type="checkbox" name="checkbox6" id="checkbox6" />
  6
  <input type="radio" name="radio" id="radio51" value="radio" />
  <input type="radio" name="radio" id="radio52" value="radio" />
  <input type="radio" name="radio" id="radio53" value="radio" />
  <input type="radio" name="radio" id="radio54" value="radio" />
  <input type="radio" name="radio" id="radio55" value="radio" />
  <input type="radio" name="radio" id="radio56" value="radio" />
  <input type="radio" name="radio" id="radio57" value="radio" />
  <input type="radio" name="radio" id="radio58" value="radio" />
  <input type="radio" name="radio" id="radio59" value="radio" />
  <input type="radio" name="radio" id="radio60" value="radio" />
  Page
  4.6</p>
  <p>
    <input type="checkbox" name="checkbox7" id="checkbox7" />
  7
  <input type="radio" name="radio" id="radio61" value="radio" />
  <input type="radio" name="radio" id="radio62" value="radio" />
  <input type="radio" name="radio" id="radio63" value="radio" />
  <input type="radio" name="radio" id="radio64" value="radio" />
  <input type="radio" name="radio" id="radio65" value="radio" />
  <input type="radio" name="radio" id="radio66" value="radio" />
  <input type="radio" name="radio" id="radio67" value="radio" />
  <input type="radio" name="radio" id="radio68" value="radio" />
  <input type="radio" name="radio" id="radio69" value="radio" />
  <input type="radio" name="radio" id="radio70" value="radio" />
  Page
  4.7</p>
  <p>
    <input type="checkbox" name="checkbox8" id="checkbox8" />
  8
  <input type="radio" name="radio" id="radio71" value="radio" />
  <input type="radio" name="radio" id="radio72" value="radio" />
  <input type="radio" name="radio" id="radio73" value="radio" />
  <input type="radio" name="radio" id="radio74" value="radio" />
  <input type="radio" name="radio" id="radio75" value="radio" />
  <input type="radio" name="radio" id="radio76" value="radio" />
  <input type="radio" name="radio" id="radio77" value="radio" />
  <input type="radio" name="radio" id="radio78" value="radio" />
  <input type="radio" name="radio" id="radio79" value="radio" />
  <input type="radio" name="radio" id="radio80" value="radio" />
  </p>
  <p>
    <input type="checkbox" name="checkbox9" id="checkbox9" /> 
    9
    <input type="radio" name="radio" id="radio81" value="radio" />
    <input type="radio" name="radio" id="radio82" value="radio" />
    <input type="radio" name="radio" id="radio83" value="radio" />
    <input type="radio" name="radio" id="radio84" value="radio" />
    <input type="radio" name="radio" id="radio85" value="radio" />
    <input type="radio" name="radio" id="radio86" value="radio" />
    <input type="radio" name="radio" id="radio87" value="radio" />
    <input type="radio" name="radio" id="radio88" value="radio" />
    <input type="radio" name="radio" id="radio89" value="radio" />
    <input type="radio" name="radio" id="radio90" value="radio" />
  </p>
  <p>
    <input type="checkbox" name="checkbox10" id="checkbox10" />
  10
  <input type="radio" name="radio" id="radio91" value="radio" />
  <input type="radio" name="radio" id="radio92" value="radio" />
  <input type="radio" name="radio" id="radio93" value="radio" />
  <input type="radio" name="radio" id="radio94" value="radio" />
  <input type="radio" name="radio" id="radio95" value="radio" />
  <input type="radio" name="radio" id="radio96" value="radio" />
  <input type="radio" name="radio" id="radio97" value="radio" />
  <input type="radio" name="radio" id="radio98" value="radio" />
  <input type="radio" name="radio" id="radio99" value="radio" />
  <input type="radio" name="radio" id="radio100" value="radio" />
  </p>
  <p>Disbled ตามหน้าที่ 2</p>
  <p>
    <input type="submit" name="button" id="button" value="Submit" />
  </p>
</form>
</body>
</html>


saveหน้า3

<!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" />
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=4.1.php'>
<title>Untitled Document</title>
</head>
 
<body>
</body>
</html>
 

และเมื่อเสร็จสิ้นที่หน้า 3 ก็คล้าย ๆ    ที่พี่นิก นำตัวอย่างมาให้เลยคับ 



คือในหน้าที่ 2 กับ 3 มี 10 ข้อ แต่มีข้อที่ 1-7 จะมีหน้าแยกไป 4.1 - 4.7

 

แล้วเมื่อ ข้อไหนถูก Disbled แล้ว จะให้ข้ามหน้านั้นไปครับ  หน้า 4.1-4.7 ก็มีการ save ข้อมูลเหมือนกัน ทุก ๆ หน้าครับ
 

เอาวิธีบ้านๆ ก็ได้ครับ ที่พี่นิค ไห้มาผม พอเข้าใจ แต่ ผม ยังไม่เก่งขั้นนั้นครับบ  รบกวนด้วยครับ




 

 


 


โดย:  Hanakobz112 IP: 58.136.23.xxx วันที่: 07-11-2014 เวลา: 09:21:57
 ความคิดเห็นที่ 3



ขอบคุนคร้าบบบ



โดย:  Hanakobz112 IP: 58.136.23.xxx วันที่: 08-10-2014 เวลา: 14:58:28
 ความคิดเห็นที่ 2
เอาไฟล์ 3 ไฟล์นี้ไปลองทำตามและรันดู และลองทำความเข้าใจกับโค้ด โดยค้นหาความรู้เพิ่มจากเว็บใน google
ถ้าเข้าใจ การทำงานของโค้ดตัวอย่างที่แนะนำไป ก็ถือว่าพัฒนาขึ้น หากยังไม่เข้าใจ ก็คงต้องพยายามต่อไป

ไฟล์ step.php

<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Home</title>
</head>
<body>
 
<form id="form1" name="form1" method="post" action="save.php">
<table width="876" border="0" cellpadding="0" cellspacing="0">

<!--ถ้าเริ่มการใช้งานคำถาม-->
<?php if(isset($_SESSION['que_id']) && $_SESSION['que_id']<=$_SESSION['total_que']){?>
  <tr>
    <td width="113" height="30" valign="top">
    Email <?=$_SESSION['new_main_que'][$_SESSION['que_id']]?> ดีเท่าไหร่
    <input type="hidden" name="h_que_id" value="<?=$_SESSION['new_main_que'][$_SESSION['que_id']]?>">
    </td>   
    <td width="271" valign="top"><input type="radio" name="radio" id="radio" value="1" />
      <input type="radio" name="radio" id="radio" value="2" />
      <input type="radio" name="radio" id="radio" value="3" />
      <input type="radio" name="radio" id="radio" value="4" />
      <input type="radio" name="radio" id="radio" value="5" />
      <input type="radio" name="radio" id="radio" value="6" />
      <input type="radio" name="radio" id="radio" value="7" />
      <input type="radio" name="radio" id="radio" value="8" />
      <input type="radio" name="radio" id="radio" value="9" />
      <input type="radio" name="radio" id="radio" value="10" />
      </td>
  </tr>  
  
<?php }else{ // ถ้ายังไม่ได้เริ่มคำถาม หรืออยู่หน้า home ?>  
 
  <?php for($i=1;$i<=7;$i++){?>
  <tr>
    <td width="133" height="30" valign="top">4.<?=$i?> Email <?=$i?></td>
    <td width="30" valign="center">
    <input type="checkbox" name="first[]" value="<?=$i?>" onClick="setCheck(this,'second<?=$i?>');" id="checkbox1">
    </td>
    <td width="262" valign="center">
      <?php for($v=10;$v>0;$v--){?>
      <input type="radio" name="radio<?=$i?>" class="second<?=$i?>" id="radio" value="<?=$v?>" />
      <?php } ?>
    </td>
  </tr>
 <?php } ?>   
 
  <tr>
    <td height="47" colspan="3" valign="top">
    <p>เมื่อ Click ที่ Email นั้นๆ จะไม่สามารถทำหน้านั้นได้แต่หน้าอื่นสามารถทำได้    </p>
      </td>
  </tr>
         
<?php } ?>  

  <tr>
    <td height="38" colspan="3" valign="top">
    <input type="submit" name="button" id="button" value="Submit" />
      </td>
  </tr>
</table>
</form>  
       
    
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
<script type="text/javascript">
    $(document).ready(function () {
        
 
        
    });
    var setCheck = function(chkObj,cssObj){
        var i_check=$(chkObj).prop("checked");
        if(i_check==true){
            $("."+cssObj).prop("checked",false).attr('disabled', true);
        }else{
            $("."+cssObj).attr('disabled', false);
        }
    };    
 
</script>       
</body>
</html>


ไฟล์ save.php

<?php  
session_start();
header("Content-type:text/html; charset=UTF-8");          
header("Cache-Control: no-store, no-cache, must-revalidate");       
header("Cache-Control: post-check=0, pre-check=0", false);       
//include("connect.php");  // สำหรับเรียกใช้งานไฟล์เชื่อมต่อฐานข้อมูล
if(!isset($_POST['h_que_id'])){ // มาจากหน้า home ยังไม่มีตัวแปรคำถามที่ x
    $_SESSION['main_que']=array(); // กำหนดตัวแปร เก็บค่า รายการคำถามทั้งหมด
    $_SESSION['new_main_que']=array(); // กำหนดตัวแปร เก็บค่า รายการที่จะมีจะใช้งาน
    $_SESSION['total_que']=0; // ไว้เก็บจำนวนข้อที่มีคำถาม
    $_SESSION['que_id']=0; // ไว้เก็บการนับคำถามที่ทำ ไว้บวกไปทีละ 1 ค่า
    for($i=1;$i<=7;$i++){ // วนลูปสร้างตัวแปร เก็บรายการคำถามทั้งหมด มี 7 คำถาม
        $_SESSION['main_que'][$i]=$i;
    }
    for($i=1;$i<=7;$i++){ // วนลูปลบคำถามที่จะไม่ใช้งาน
        if(count($_POST['first'])>0){ //เมื่อมีการเลือก คำถามที่จะไม่ใช้งาน
            if(in_array($i,$_POST['first'])){ // ตรวจสอบคำถามที่จะไม่ใช้งาน
                unset($_SESSION['main_que'][$i]); // ลบคำถามที่จะไม่ใช้งาน       
            }
        }
    }
    $_SESSION['total_que']=count($_SESSION['main_que']); // นับจำนวนคำถามที่จะใช้งานทั้งหมด
    if($_SESSION['total_que']>0){ // ถ้ามากกว่า 0
        $i=1;
        foreach($_SESSION['main_que'] as $v){  // วนลูปจัดรูปแบบคำถามใหม่ ให้ค่า key ของตัวแปรเริ่มที่ 1
            $_SESSION['new_main_que'][$i]=$v; // จัดรูปแบบตัวแปรคำถามที่จะใช้งานและใช้ค่า key ใหม่
            $i++;
        }
        $_SESSION['que_id']=1; // เริ่มตัวแปรคำถามแรกที่ key เท่ากับ 1
    }
    // คำสั่งบันทึกข้อมูลจากหน้า home ครั้งแรก
    header("Location:step.php"); // กลับไปหน้า home เริ่มทำคำถาม
    exit;
}else{ // เมื่อมีการเริ่มทำคำถาม
    
    // สำหรับบันทึกข้อมูล $_POST['h_que_id'] คือ id ของคำถามที่เราจะบันทึก
    // $_POST['radio'] คือค่าที่เลือก 
    $_SESSION['que_id']++; // เพิ่มค่า key ของคำถาม เพื่อเปลี่ยนเป็นข้อถัดไป
    if($_SESSION['que_id']>$_SESSION['total_que']){ // ถ้า มากกว่าจำนวนคำถาม ให้สิ้นสุดการทำงาน
        unset($_SESSION['total_que']); // ล้างคาจำนวนคำถาม ถ้าจะใช้อยู่ ไม่ต้องล้างค่า
        unset($_SESSION['que_id']); // ล่้างค่า key คำถาม
        foreach($_SESSION['main_que'] as $k=>$v){ // วนลูปล้างค่า คำถามทั้งหมด
            unset($_SESSION['main_que'][$k]);
        }  
        foreach($_SESSION['new_main_que'] as $k=>$v){ // วนลูปล้างค่า คำถามที่ใช้งานทั้งหมด
            unset($_SESSION['new_main_que'][$k]);
        }           
        header("Location:finished.php"); // ไปหน้าเสร็จการทำงาน       
    }else{
        // คำสั่งบันทึกลงฐานข้อมูล ใส่ตรงนี้
        header("Location:step.php");  // กลับไปทำงานคำถามถัดไป
    }
    exit;    
}
?>


ไฟล์ finished.php

<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Finished</title>
</head>
<body>
    <a href="step.php">เริ่มใหม่</a>
</body>
</html>


โดย:  Ninenik IP: 124.121.245.xxx วันที่: 08-10-2014
 ความคิดเห็นที่ 1

ตรง หน้า save databate ของแต่ละตัว ผมเขียนผิด tableนะครับ


$sql = "insert into email1 (E1)

$sql = "insert into email2 (E2)
$sql = "insert into email3 (E3)
$sql = "insert into email4 (E4)
$sql = "insert into email5 (E5)
$sql = "insert into email6 (E6)
$sql = "insert into email7 (E7)

แก้ไขหน้า home ด้วยครับ
 

<!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" />
<title>Untitled Document</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="savehome.php">
<table width="876" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="30" colspan="2" valign="top">4.1 Email 1</td>
    <td width="30" valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second');" id="checkbox1"></td>
    <td width="262" valign="center"><input type="radio" name="radio1" class="second" id="radio" value="10" />
      <input type="radio" name="radio1" class="second" id="radio2" value="9" />
      <input type="radio" name="radio1" class="second" id="radio3" value="8" />
      <input type="radio" name="radio1" class="second" id="radio4" value="7" />
      <input type="radio" name="radio1" class="second" id="radio5" value="6" />
      <input type="radio" name="radio1" class="second" id="radio6" value="5" />
      <input type="radio" name="radio1" class="second" id="radio7" value="4" />
      <input type="radio" name="radio1" class="second" id="radio8" value="3" />
      <input type="radio" name="radio1" class="second" id="radio9" value="2" />
      <input type="radio" name="radio1" class="second" id="radio10" value="1" /></td>
    <td width="115">&nbsp;</td>
    <td width="339">&nbsp;</td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.2 Email 2</td>
   <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second2');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio2" class="second2" id="radio" value="10" />
      <input type="radio" name="radio2" class="second2" id="radio2" value="9" />
      <input type="radio" name="radio2" class="second2" id="radio3" value="8" />
      <input type="radio" name="radio2" class="second2" id="radio4" value="7" />
      <input type="radio" name="radio2" class="second2" id="radio5" value="6" />
      <input type="radio" name="radio2" class="second2" id="radio6" value="5" />
      <input type="radio" name="radio2" class="second2" id="radio7" value="4" />
      <input type="radio" name="radio2" class="second2" id="radio8" value="3" />
      <input type="radio" name="radio2" class="second2" id="radio9" value="2" />
      <input type="radio" name="radio2" class="second2" id="radio10" value="1" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.3 Email 3</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second3');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio3" class="second3" id="radio" value="10" />
      <input type="radio" name="radio3" class="second3" id="radio2" value="9" />
      <input type="radio" name="radio3" class="second3" id="radio3" value="8" />
      <input type="radio" name="radio3" class="second3" id="radio4" value="7" />
      <input type="radio" name="radio3" class="second3" id="radio5" value="6" />
      <input type="radio" name="radio3" class="second3" id="radio6" value="5" />
      <input type="radio" name="radio3" class="second3" id="radio7" value="4" />
      <input type="radio" name="radio3" class="second3" id="radio8" value="3" />
      <input type="radio" name="radio3" class="second3" id="radio9" value="2" />
      <input type="radio" name="radio3" class="second3" id="radio10" value="1" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.4 Email 4</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second4');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio4" class="second4" id="radio" value="10" />
      <input type="radio" name="radio4" class="second4" id="radio2" value="9" />
      <input type="radio" name="radio4" class="second4" id="radio3" value="8" />
      <input type="radio" name="radio4" class="second4" id="radio4" value="7" />
      <input type="radio" name="radio4" class="second4" id="radio5" value="6" />
      <input type="radio" name="radio4" class="second4" id="radio6" value="5" />
      <input type="radio" name="radio4" class="second4" id="radio7" value="4" />
      <input type="radio" name="radio4" class="second4" id="radio8" value="3" />
      <input type="radio" name="radio4" class="second4" id="radio9" value="2" />
      <input type="radio" name="radio4" class="second4" id="radio10" value="1" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.5 Email 5</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second5');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio5" class="second5" id="radio" value="10" />
      <input type="radio" name="radio5" class="second5" id="radio2" value="9" />
      <input type="radio" name="radio5" class="second5" id="radio3" value="8" />
      <input type="radio" name="radio5" class="second5" id="radio4" value="7" />
      <input type="radio" name="radio5" class="second5" id="radio5" value="6" />
      <input type="radio" name="radio5" class="second5" id="radio6" value="5" />
      <input type="radio" name="radio5" class="second5" id="radio7" value="4" />
      <input type="radio" name="radio5" class="second5" id="radio8" value="3" />
      <input type="radio" name="radio5" class="second5" id="radio9" value="2" />
      <input type="radio" name="radio5" class="second5" id="radio10" value="1" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.6 Email 6</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second6');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio6" class="second6" id="radio" value="10" />
      <input type="radio" name="radio6" class="second6" id="radio2" value="9" />
      <input type="radio" name="radio6" class="second6" id="radio3" value="8" />
      <input type="radio" name="radio6" class="second6" id="radio4" value="7" />
      <input type="radio" name="radio6" class="second6" id="radio5" value="6" />
      <input type="radio" name="radio6" class="second6" id="radio6" value="5" />
      <input type="radio" name="radio6" class="second6" id="radio7" value="4" />
      <input type="radio" name="radio6" class="second6" id="radio8" value="3" />
      <input type="radio" name="radio6" class="second6" id="radio9" value="2" />
      <input type="radio" name="radio6" class="second6" id="radio10" value="1" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="30" colspan="2" valign="top">4.7 Email 7</td>
    <td valign="center"><input type="checkbox" name="first" value="Disable" onClick="setCheck(this,'second7');" id="checkbox1"></td>
    <td valign="center"> <input type="radio" name="radio7" class="second7" id="radio" value="10" />
      <input type="radio" name="radio7" class="second7" id="radio2" value="9" />
      <input type="radio" name="radio7" class="second7" id="radio3" value="8" />
      <input type="radio" name="radio7" class="second7" id="radio4" value="7" />
      <input type="radio" name="radio7" class="second7" id="radio5" value="6" />
      <input type="radio" name="radio7" class="second7" id="radio6" value="5" />
      <input type="radio" name="radio7" class="second7" id="radio7" value="4" />
      <input type="radio" name="radio7" class="second7" id="radio8" value="3" />
      <input type="radio" name="radio7" class="second7" id="radio9" value="2" />
      <input type="radio" name="radio7" class="second7" id="radio10" value="1" /></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="47" colspan="5" valign="top"><p>เมื่อ Click ที่ Email นั้นๆ จะไม่สามารถทำหน้านั้นได้แต่หน้าอื่นสามารถทำได้    </p>
      <p>&nbsp;</p></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="113" height="38" valign="top"><input type="submit" name="button" id="button" value="Submit" />
      <label></label></td>
    <td width="17">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="210">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
 
<script src="js/jquery-1.8.3.min.js"></script>  
 
<script type="text/javascript">
    $(document).ready(function () {
        
 
        
    });
    var setCheck = function(chkObj,cssObj){
        var i_check=$(chkObj).prop("checked");
        if(i_check==true){
            $("."+cssObj).prop("checked",false).attr('disabled', true);
        }else{
            $("."+cssObj).attr('disabled', false);
        }
    };    
 
</script>
 
 
</body>
</html>
 

และก็อันนี้หน้า save ของ home นะครับ

<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=email1.php'>
<?
 
include ('connect.php');
$sql = "insert into home (h1,h2,h3,h4,h5,h6,h7)
VALUES ('$_POST[radio1]','$_POST[radio2]','$_POST[radio3]','$_POST[radio4]','$_POST[radio5]','$_POST[radio6]','$_POST[radio7]')";
 
$result = mysql_query($sql);
 
if($result)
{
 
}
else
{
echo"<script language='JavaScript'>";
echo"alert('Error :: No Complete [".$result."]');";
echo"</script>";
}
mysql_close();
?>



โดย:  Hanakobz112 IP: 202.183.201.xxx วันที่: 08-10-2014 เวลา: 11:06:33