วันพุธที่ 26 พฤศจิกายน พ.ศ. 2557

โค้ดแสดงหน้า Report

โค้ดแสดงหน้า Report


<?php require_once('Connections/myconect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;  
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_myconect, $myconect);
$query_cnblue = "SELECT * FROM mama";
$cnblue = mysql_query($query_cnblue, $myconect) or die(mysql_error());
$row_cnblue = mysql_fetch_assoc($cnblue);
$totalRows_cnblue = mysql_num_rows($cnblue);

$maxRows_report = 10;
$pageNum_report = 0;
if (isset($_GET['pageNum_report'])) {
  $pageNum_report = $_GET['pageNum_report'];
}
$startRow_report = $pageNum_report * $maxRows_report;

mysql_select_db($database_myconect, $myconect);
$query_report = "SELECT * FROM mama";
$query_limit_report = sprintf("%s LIMIT %d, %d", $query_report, $startRow_report, $maxRows_report);
$report = mysql_query($query_limit_report, $myconect) or die(mysql_error());
$row_report = mysql_fetch_assoc($report);

if (isset($_GET['totalRows_report'])) {
  $totalRows_report = $_GET['totalRows_report'];
} else {
  $all_report = mysql_query($query_report);
  $totalRows_report = mysql_num_rows($all_report);
}
$totalPages_report = ceil($totalRows_report/$maxRows_report)-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>
<?php do { ?>
  <form id="form1" name="form1" method="POST">
    <p>มหาวิทยาลัยเกริก (ม.กร) </p>
    <p>รหัสนักศึกษา
      <label for="textfield46"></label>
      <input name="stu_id" type="text" id="textfield46" value="<?php echo $row_report['stu_id']; ?>" />
    </p>
 
    <p>GPA
      <label for="year"></label>
      <input name="GPA" type="text" id="textfield2" value="<?php echo $row_report['GPA']; ?>" />
    </p>
    <p>ภาค
      <label for="sector"></label>
      <label for="sector"></label>
      <select name="sector" id="sector">
        <option value="ต้น" selected="selected">ต้น</option>
        <option value="ปลาย">ปลาย</option>
        <option value="ฤดูร้อน">ฤดูร้อน</option>
      </select>
    </p>
    <p>ปีการศึกษา
      <label for="name"></label>
      <input name="year" type="text" id="textfield3" value="<?php echo $row_report['year']; ?>" />
    </p>
    <p>ชื่อ
      <label for="yearstu"></label>
      <input name="name" type="text" id="textfield4" value="<?php echo $row_report['name']; ?>" />
    </p>
    <p>นักศึกษาชั้นปี
      <label for="faculty"></label>
      <input name="yearstu" type="text" id="textfield5" value="<?php echo $row_report['yearstu']; ?>" />
    </p>
    <p>ภาค
      <label for="sectorr"></label>
      <select name="sectorr" id="sectorr">
        <option value="ปกติ" selected="selected">ปกติ</option>
        <option value="ภาคค่ำ">ภาคค่ำ</option>
      </select>
    </p>
    <p>รูปแบบ
      <label for="style"></label>
      <select name="style" id="style">
        <option value="4 ปี">4 ปี</option>
        <option value="ต่อเนื่อง">ต่อเนื่อง</option>
        <option value="เทียบโอน">เทียบโอน</option>
      </select>
    </p>
    <p>คณะ
      <label for="education"></label>
      <input name="faculty" type="text" id="textfield6" value="<?php echo $row_report['faculty']; ?>" />
    </p>
    <p>สาขา
      <label for="adviser"></label>
      <input name="education" type="text" id="textfield7" value="<?php echo $row_report['education']; ?>" />
    </p>
    <p id="GPA">อาจารย์ที่ปรึกษา
      <label for="textfield8"></label>
      <input name="adviser" type="text" id="textfield8" value="<?php echo $row_report['adviser']; ?>" />
    </p>
    <table width="1380" height="301" border="1">
      <tr>
        <td width="137"><blockquote>
          <p>รหัสวิชา</p>
        </blockquote></td>
        <td width="382"><blockquote>
          <blockquote>
            <blockquote>
              <blockquote>
                <p>ชื่อวิชา</p>
                </blockquote>
              </blockquote>
            </blockquote>
        </blockquote></td>
        <td width="66">หน่วยกิต</td>
        <td width="60">กลุ่ม </td>
        <td width="60">เกรด</td>
        <td width="60">แต้ม</td>
        <td width="569">เอกสารฉบับบนี้ให้แทนใบเสร็จรับเงิน</td>
      </tr>
      <tr>
        <td><label for="department_id"></label>
        <input name="department_id" type="text" id="department_id" value="<?php echo $row_report['department_id']; ?>" size="15" /></td>
        <td><label for="department_name"></label>
        <input name="department_name" type="text" id="department_name" value="<?php echo $row_report['department_name']; ?>" size="10" /></td>
        <td><label for="credit"></label>
        <input name="credit" type="text" id="credit" value="<?php echo $row_report['group']; ?>" size="10" /></td>
        <td><label for="group"></label>
        <input name="group" type="text" id="group" value="<?php echo $row_report['group']; ?>" size="10" /></td>
        <td><label for="gread"></label>
        <input name="gread" type="text" id="gread" value="<?php echo $row_report['gread']; ?>" size="10" /></td>
        <td><label for="textfield39"></label>
        <input name="textfield39" type="text" id="textfield39" size="10" /></td>
        <td rowspan="7" valign="top"><p>  เดิมลงทะเบียน
          <label for="education"></label>
          <label for="education"></label>
          <input name="textfield6" type="text" id="textfield6" size="5" />
          หน่วยกิต</p>
  <p>ขอเพิ่ม
    <label for="adviser"></label>
    <input name="textfield7" type="text" id="textfield7" size="5" />
    หน่วยกิต</p>
  <p>รวมเป็น
    <label for="textfield8"></label>
    <input name="textfield8" type="text" id="textfield8" size="5" />
    หน่วยกิต</p>
  <p>ชำระเงินเพิ่ม (ถ้ามี)
    <label for="textfield9"></label>
    <input name="textfield9" type="text" id="textfield9" size="5" />
    บาท</p>
  <p>ลงนาม</p>
  <p>&nbsp;</p>
  <p>จนท.การเงิน</p>
  <p>......./....../......</p></td>
      </tr>
      <tr>
        <td><label for="deportment_id"></label>
        <input name="deportment_id" type="text" id="deportment_id" value="<?php echo $row_report['department_id']; ?>" size="15" /></td>
        <td><label for="dep"></label>
        <input name="dep" type="text" id="dep" size="10" /></td>
        <td><label for="textfield22"></label>
        <input name="textfield22" type="text" id="textfield22" size="10" /></td>
        <td><label for="textfield28"></label>
        <input name="textfield28" type="text" id="textfield28" size="10" /></td>
        <td><label for="textfield34"></label>
        <input name="textfield34" type="text" id="textfield34" size="10" /></td>
        <td><label for="textfield40"></label>
        <input name="textfield40" type="text" id="textfield40" size="10" /></td>
      </tr>
      <tr>
        <td><label for="textfield12"></label>
        <input name="textfield12" type="text" id="textfield12" size="15" /></td>
        <td><label for="textfield18"></label>
        <input name="textfield18" type="text" id="textfield18" size="10" /></td>
        <td><label for="textfield23"></label>
        <input name="textfield23" type="text" id="textfield23" size="10" /></td>
        <td><label for="textfield29"></label>
        <input name="textfield29" type="text" id="textfield29" size="10" /></td>
        <td><label for="textfield35"></label>
        <input name="textfield35" type="text" id="textfield35" size="10" /></td>
        <td><label for="textfield41"></label>
        <input name="textfield41" type="text" id="textfield41" size="10" /></td>
      </tr>
      <tr>
        <td><label for="textfield13"></label>
        <input name="textfield13" type="text" id="textfield13" size="15" /></td>
        <td><label for="textfield19"></label>
        <input name="textfield19" type="text" id="textfield19" size="10" /></td>
        <td><label for="textfield24"></label>
        <input name="textfield24" type="text" id="textfield24" size="10" /></td>
        <td><label for="textfield30"></label>
        <input name="textfield30" type="text" id="textfield30" size="10" /></td>
        <td><label for="textfield36"></label>
        <input name="textfield36" type="text" id="textfield36" size="10" /></td>
        <td><label for="textfield42"></label>
        <input name="textfield42" type="text" id="textfield42" size="10" /></td>
      </tr>
      <tr>
        <td><label for="textfield14"></label>
        <input name="textfield14" type="text" id="textfield14" size="15" /></td>
        <td><label for="textfield20"></label>
        <input name="textfield20" type="text" id="textfield20" size="10" /></td>
        <td><label for="textfield25"></label>
        <input name="textfield25" type="text" id="textfield25" size="10" /></td>
        <td><label for="textfield31"></label>
        <input name="textfield31" type="text" id="textfield31" size="10" /></td>
        <td><label for="textfield37"></label>
        <input name="textfield37" type="text" id="textfield37" size="10" /></td>
        <td><label for="textfield43"></label>
        <input name="textfield43" type="text" id="textfield43" size="10" /></td>
      </tr>
      <tr>
        <td><label for="textfield15"></label>
        <input name="textfield15" type="text" id="textfield15" size="15" /></td>
        <td>รวม
        <label for="textfield45"></label></td>
        <td><label for="textfield26"></label>
        <input name="textfield26" type="text" id="textfield26" size="10" /></td>
        <td><label for="textfield32"></label>
        <input name="textfield32" type="text" id="textfield32" size="10" /></td>
        <td><label for="textfield38"></label>
        <input name="textfield38" type="text" id="textfield38" size="10" /></td>
        <td><label for="textfield44"></label>
        <input name="textfield44" type="text" id="textfield44" size="10" /></td>
      </tr>
      <tr>
        <td height="102"><input name="textfield45" type="text" id="textfield45" size="10" /></td>
        <td align="right"><blockquote>
          <blockquote>
            <blockquote>
              <blockquote>
                <p>&nbsp;</p>
                </blockquote>
              </blockquote>
            </blockquote>
        </blockquote></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <label for="GPA"></label>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><p>&nbsp;</p>
      <p>
        <input type="submit" name="button" id="button" value="บันทึก" />
    </p></td>
  </form>
  <?php } while ($row_report = mysql_fetch_assoc($report)); ?>
</body>
</html>
<?php
mysql_free_result($cnblue);

mysql_free_result($report);
?>



โค้ดใส่ข้อมูล


โค้ดใส่ข้อมูล

<?php require_once('Connections/myconect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;  
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO mama (stu_id, name, `year`, yearstu, faculty, education, sector, sectorr, adviser, department_id, department_name, cedit, `group`, GPA, style, gread) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['stu_id'], "int"),
                       GetSQLValueString($_POST['name'], "text"),
                       GetSQLValueString($_POST['year'], "text"),
                       GetSQLValueString($_POST['yearstu'], "text"),
                       GetSQLValueString($_POST['faculty'], "text"),
                       GetSQLValueString($_POST['education'], "text"),
                       GetSQLValueString($_POST['sector'], "text"),
                       GetSQLValueString($_POST['sectorr'], "text"),
                       GetSQLValueString($_POST['adviser'], "text"),
                       GetSQLValueString($_POST['department_id'], "text"),
                       GetSQLValueString($_POST['department_name'], "text"),
                       GetSQLValueString($_POST['credit'], "text"),
                       GetSQLValueString($_POST['group'], "text"),
                       GetSQLValueString($_POST['GPA'], "text"),
                       GetSQLValueString($_POST['style'], "text"),
                       GetSQLValueString($_POST['gread'], "double"));

  mysql_select_db($database_myconect, $myconect);
  $Result1 = mysql_query($insertSQL, $myconect) or die(mysql_error());
}

mysql_select_db($database_myconect, $myconect);
$query_cnblue = "SELECT * FROM mama";
$cnblue = mysql_query($query_cnblue, $myconect) or die(mysql_error());
$row_cnblue = mysql_fetch_assoc($cnblue);
$totalRows_cnblue = mysql_num_rows($cnblue);
?>
<!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 action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
  <p>มหาวิทยาลัยเกริก (ม.กร) </p>
  <p>รหัสนักศึกษา
    <label for="textfield46"></label>
    <input type="text" name="stu_id" id="textfield46" />
  </p>

  <p>GPA
    <label for="year"></label>
    <input type="text" name="GPA" id="textfield2" />
  </p>
  <p>ภาค
    <label for="sector"></label>
    <label for="sector"></label>
    <select name="sector" id="sector">
      <option value="ต้น" selected="selected">ต้น</option>
      <option value="ปลาย">ปลาย</option>
      <option value="ฤดูร้อน">ฤดูร้อน</option>
    </select>
  </p>
  <p>ปีการศึกษา
    <label for="name"></label>
    <input type="text" name="year" id="textfield3" />
  </p>
  <p>ชื่อ
    <label for="yearstu"></label>
    <input type="text" name="name" id="textfield4" />
  </p>
  <p>นักศึกษาชั้นปี
    <label for="faculty"></label>
    <input type="text" name="yearstu" id="textfield5" />
  </p>
  <p>ภาค
    <label for="sectorr"></label>
    <select name="sectorr" id="sectorr">
      <option value="ปกติ" selected="selected">ปกติ</option>
      <option value="ภาคค่ำ">ภาคค่ำ</option>
    </select>
  </p>
  <p>รูปแบบ
    <label for="style"></label>
    <select name="style" id="style">
      <option value="4 ปี">4 ปี</option>
      <option value="ต่อเนื่อง">ต่อเนื่อง</option>
      <option value="เทียบโอน">เทียบโอน</option>
    </select>
  </p>
  <p>คณะ
    <label for="education"></label>
    <input type="text" name="faculty" id="textfield6" />
  </p>
  <p>สาขา
    <label for="adviser"></label>
    <input type="text" name="education" id="textfield7" />
  </p>
  <p id="GPA">อาจารย์ที่ปรึกษา
    <label for="textfield8"></label>
    <input type="text" name="adviser" id="textfield8" />
  </p>
  <table width="1380" height="301" border="1">
    <tr>
      <td width="137"><blockquote>
        <p>รหัสวิชา</p>
      </blockquote></td>
      <td width="382"><blockquote>
        <blockquote>
          <blockquote>
            <blockquote>
              <p>ชื่อวิชา</p>
            </blockquote>
          </blockquote>
        </blockquote>
      </blockquote></td>
      <td width="66">หน่วยกิต</td>
      <td width="60">กลุ่ม </td>
      <td width="60">เกรด</td>
      <td width="60">แต้ม</td>
      <td width="569">เอกสารฉบับบนี้ให้แทนใบเสร็จรับเงิน</td>
    </tr>
    <tr>
      <td><label for="department_id"></label>
      <input name="department_id" type="text" id="department_id" size="15" /></td>
      <td><label for="department_name"></label>
      <input name="department_name" type="text" id="department_name" size="10" /></td>
      <td><label for="credit"></label>
      <input name="credit" type="text" id="credit" size="10" /></td>
      <td><label for="group"></label>
      <input name="group" type="text" id="group" size="10" /></td>
      <td><label for="gread"></label>
      <input name="gread" type="text" id="gread" size="10" /></td>
      <td><label for="textfield39"></label>
      <input name="textfield39" type="text" id="textfield39" size="10" /></td>
      <td rowspan="7" valign="top"><p>  เดิมลงทะเบียน
        <label for="education"></label>
        <label for="education"></label>
        <input name="textfield6" type="text" id="textfield6" size="5" />
        หน่วยกิต</p>
<p>ขอเพิ่ม
  <label for="adviser"></label>
  <input name="textfield7" type="text" id="textfield7" size="5" />
หน่วยกิต</p>
<p>รวมเป็น
  <label for="textfield8"></label>
  <input name="textfield8" type="text" id="textfield8" size="5" />
หน่วยกิต</p>
<p>ชำระเงินเพิ่ม (ถ้ามี)
  <label for="textfield9"></label>
  <input name="textfield9" type="text" id="textfield9" size="5" />
  บาท</p>
<p>ลงนาม</p>
<p>&nbsp;</p>
<p>จนท.การเงิน</p>
<p>......./....../......</p></td>
    </tr>
    <tr>
      <td><label for="epartment_id"></label>
      <input name="epartment_id" type="text" id="epartment_id" size="15" /></td>
      <td><label for="deportment_name"></label>
      <input name="deportment_name" type="text" id="deportment_name" size="10" /></td>
      <td><label for="credit"></label>
      <input name="credit" type="text" id="credit" size="10" /></td>
      <td><label for="textfield28"></label>
      <input name="textfield28" type="text" id="textfield28" size="10" /></td>
      <td><label for="textfield34"></label>
      <input name="textfield34" type="text" id="textfield34" size="10" /></td>
      <td><label for="textfield40"></label>
      <input name="textfield40" type="text" id="textfield40" size="10" /></td>
    </tr>
    <tr>
      <td><label for="textfield12"></label>
      <input name="textfield12" type="text" id="textfield12" size="15" /></td>
      <td><label for="textfield18"></label>
      <input name="textfield18" type="text" id="textfield18" size="10" /></td>
      <td><label for="textfield23"></label>
      <input name="textfield23" type="text" id="textfield23" size="10" /></td>
      <td><label for="textfield29"></label>
      <input name="textfield29" type="text" id="textfield29" size="10" /></td>
      <td><label for="textfield35"></label>
      <input name="textfield35" type="text" id="textfield35" size="10" /></td>
      <td><label for="textfield41"></label>
      <input name="textfield41" type="text" id="textfield41" size="10" /></td>
    </tr>
    <tr>
      <td><label for="textfield13"></label>
      <input name="textfield13" type="text" id="textfield13" size="15" /></td>
      <td><label for="textfield19"></label>
      <input name="textfield19" type="text" id="textfield19" size="10" /></td>
      <td><label for="textfield24"></label>
      <input name="textfield24" type="text" id="textfield24" size="10" /></td>
      <td><label for="textfield30"></label>
      <input name="textfield30" type="text" id="textfield30" size="10" /></td>
      <td><label for="textfield36"></label>
      <input name="textfield36" type="text" id="textfield36" size="10" /></td>
      <td><label for="textfield42"></label>
      <input name="textfield42" type="text" id="textfield42" size="10" /></td>
    </tr>
    <tr>
      <td><label for="textfield14"></label>
      <input name="textfield14" type="text" id="textfield14" size="15" /></td>
      <td><label for="textfield20"></label>
      <input name="textfield20" type="text" id="textfield20" size="10" /></td>
      <td><label for="textfield25"></label>
      <input name="textfield25" type="text" id="textfield25" size="10" /></td>
      <td><label for="textfield31"></label>
      <input name="textfield31" type="text" id="textfield31" size="10" /></td>
      <td><label for="textfield37"></label>
      <input name="textfield37" type="text" id="textfield37" size="10" /></td>
      <td><label for="textfield43"></label>
      <input name="textfield43" type="text" id="textfield43" size="10" /></td>
    </tr>
    <tr>
      <td><label for="textfield15"></label>
      <input name="textfield15" type="text" id="textfield15" size="15" /></td>
      <td>รวม
        <label for="textfield45"></label>
      <input name="textfield45" type="text" id="textfield45" size="10" /></td>
      <td><label for="textfield26"></label>
      <input name="textfield26" type="text" id="textfield26" size="10" /></td>
      <td><label for="textfield32"></label>
      <input name="textfield32" type="text" id="textfield32" size="10" /></td>
      <td><label for="textfield38"></label>
      <input name="textfield38" type="text" id="textfield38" size="10" /></td>
      <td><label for="textfield44"></label>
      <input name="textfield44" type="text" id="textfield44" size="10" /></td>
    </tr>
    <tr>
      <td height="102">&nbsp;</td>
      <td align="right"><blockquote>
        <blockquote>
          <blockquote>
            <blockquote>
              <p>&nbsp;</p>
            </blockquote>
          </blockquote>
        </blockquote>
      </blockquote></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <label for="GPA"></label>
  <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
  <td><p>&nbsp;</p>
  <p>
    <input type="submit" name="button" id="button" value="บันทึก" />
  </p></td>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
<?php
mysql_free_result($cnblue);
?>





Code Connect Database

โค้ดเชื่อมฐานข้อมูลกับดาต้าเบส

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_myconect = "localhost";
$database_myconect = "kru";
$username_myconect = "root";
$password_myconect = "12345";
$myconect = mysql_pconnect($hostname_myconect, $username_myconect, $password_myconect) or trigger_error(mysql_error(),E_USER_ERROR);


โค้ดให้แสดงตัวอักษรภาษาไทย

mysql_query("SET NAMES UTF8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");

?>

แสดงฐานข้อมูล (DATABASE) ในระบบ









วันพฤหัสบดีที่ 30 ตุลาคม พ.ศ. 2557

แบบทดสอบย่อยครั้งที่ 3 30/10/2014



Dreamweaver.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" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <p>ชื่อ
    <label for="textfield"></label>
  <input type="text" name="textfield" id="textfield" />
  นามสกุล
  <label for="textfield2"></label>
  <input type="text" name="textfield2" id="textfield2" />
  </p>
  <p>อายุ</p>
  <p>
    <input type="radio" name="radio" id="radio" value="radio" />
    <label for="radio"></label>ชาย
    <input type="radio" name="radio2" id="radio2" value="radio2" />
    <label for="radio2"></label>หญิง
  </p>
  <p>อายุ
    <label for="textfield3"></label>
    <input type="text" name="textfield3" id="textfield3" />
  </p>
  <p>ระดับการศึกษา</p>
  <p>
    <label for="select"></label>
    <select name="select" id="select">
      <option>มัธยมศึกษาตอนต้น</option>
      <option>มัธยมศึกษาตอนปลาย</option>
      <option>ปริญญาตรี</option>
      <option>ปริญญาโท</option>
      <option>ปริญญาเอก</option>
    </select>
   
  </p>
  <p>เบอร์โทรศัพท์
    <label for="textfield4"></label>
    <input type="text" name="textfield4" id="textfield4" />
  </p>
  <p>
    <input type="submit" name="button" id="button" value="Submit" />
    <input type="submit" name="button2" id="button2" value="Resrt" />
  </p>
 
</form>
</body>
</html>

ผลลัพธ์

แบบทดสอบย่อยครั้งที่2 30/10/2014



Dreamweaver



<!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>แบบฟอร์อมกรอกข้อมูลบุคลากร</title>
</head>

<body>
ชื่อ<INPUT TYPE = "text" NAME = "text name"/>

นามสกุล <INPUT TYPE = "text" NAME= "text_lastname"/><br/>

เพศ <br/>
<INPUT TYPE = "radio" NAME = "sex" =vslue="M" checked=checked=/>ชาย
<INPUT TYPE = "radio" NAME = "sex" =vslue="F" checked=checked=/>หญิง
<br/>

อาย <INPUT TYPE = "text" NAME = "text age" size="6"/><br/>

ระดับการศึกษา <br/>
<select name="education">
<option value="1" selected="selected">มัธยมศึกษาตอนต้น</option>option>
<option value="2" >มัธยมศึกษาตอนปลาย</option>
<option value="2" >ปริญญาตรี</option>
<option value="2" >ปริญญาโท</option>
<option value="2" >ปริญญาเอก</option>
</select>
<br/>

เบอร์โทรศัพท์<input type="text" name="text_tel"/><br/>
<input type="submit" value="บันทึก"/>
<input type="reset" value="ยกเลิก"/><br/>
</body>
</html>


ผลลัพธ์


วันพฤหัสบดีที่ 9 ตุลาคม พ.ศ. 2557

แบบทดสอบย่อยครั้งที่1


</HTML>
<HEAD><TITLE></TITLE>
</HEAD>
<BODY BGCOLOR = #FFFF99>
<P><CENTER><IMG SRC = "C:\Documents and Settings\student\Desktop\krirk.gif"</P></CENTER>
<H2 ALIGN ="CENTER"><STRONG>มหาวิทยาลัยเกริก (ม.กร.)
<H2 ALIGN ="CENTER"><STRONG>KRIRK UNIVERSITY (KR.U)

</body>
</html>

<HTML>
<HEAD><TITLE>การสร้าง Form โดยใช้ Text Box</TITLE>
</HEAD>
<BODY>
   <FORM>
   <H1></H1>
   <H3> คณะ: <INPUT TYPE = "text" NAME = "Factory" SIZE = 25>
      สาขา : <INPUT TYPE = "text" NAME = "major" SIZE = 25 >
   <H3>รหัสะ: <INPUT TYPE = "text" NAME = "code" SIZE = 25>
                  วิชา: <INPUT TYPE = "text" NAME = "department" SIZE = 25 >
                 กลุ่ม: <INPUT TYPE = "text" NAME = "group" SIZE = 25>
 <H3>ชื่อ : <INPUT TYPE = "text" NAME = "username" SIZE = 25>
           นามสกุล : <INPUT TYPE = "text" NAME = "surname" SIZE = 25>
         รหัสประจำตัว : <INPUT TYPE = "text" NAME = "Identity code" SIZE = 25>
<H3>ห้องสอบ : <INPUT TYPE = "text" NAME = "room id" SIZE = 25>
วันที่ : <INPUT TYPE = "text" NAME = "date" SIZE = 25>
เดือน : <INPUT TYPE = "text" NAME = "month" SIZE = 25>
พ.ศ. : <INPUT TYPE = "text" NAME = "year" SIZE = 25>

</FROM>
</BODY>
</HTML>


ผลลัพธ์







วันพุธที่ 8 ตุลาคม พ.ศ. 2557

ตัวอย่างที่ 4.11

ตัวอย่างที่ 4.11

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.W3.orq/1999/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.W3.orq/1999/xhtml1">
<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>ทดสอบการแสดงผลของ Background-image</title>
</head>
<body style = "Background-image :url (file:///H:/2556-1/การเขียนโปรแกรมบนเว็บ/file_exe_zip/code_webprogramming/Chapter 4 /Blue hills.jpg)">
<p style = "margin-left:30px; margin-right:30px; margin-top:50px; margin-size:20px; font-width:bold;color:#FF33FF">
<p>"นก"เป้นสัตว์เลียงที่มีผู้นิยมเลี้ยงเป็นจำนวนมาก นื่องจากเป็นสัตว์ที่มีความสวยงาม สำหรับผู้ที่ชื่นชอบ เช่น นก Lovebird,นกหงส์หยก,นกแก้วสายพันธ์ต่างๆ เป็นต้น อย่างไรก็ตามการเลี้ยงนกบางประเภทนั้น อาจผิดกฎหมายคุ้มครองสัตว์ป่า ซึ่งผู้เลี้ยงต้องทำการศึกษารายลtเอียดด้วย
</p>
</body>
</html>

ตัวอย่างที่ 4.10

ตัวอย่างที่ 4.10

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.W3.orq/1999/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.W3.orq/1999/xhtml1">
<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>ทดสอบการแสดงผลของ Align และ Float </title>
</head>
<body>
<p>
<imgsrc="bird.jpg" style="float:right"/>
</p>
<p>"นก"เป้นสัตว์เลียงที่มีผู้นิยมเลี้ยงเป็นจำนวนมาก นื่องจากเป็นสัตว์ที่มีความสวยงาม สำหรับผู้ที่ชื่นชอบ เช่น นก Lovebird,นกหงส์หยก,นกแก้วสายพันธ์ต่างๆ เป็นต้น อย่างไรก็ตามการเลี้ยงนกบางประเภทนั้น อาจผิดกฎหมายคุ้มครองสัตว์ป่า ซึ่งผู้เลี้ยงต้องทำการสึกษารายลัเอียดด้วย
</p>
</body>
</html>

ตัวอย่างที่ 4.9

ตัวอย่างที่ 4.9

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.W3.orq/1999/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.W3.orq/1999/xhtml1">
<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>ทดสอบ Properties font รูปแบบต่างๆ</title>
<body>
<h3>ทดสอบการแสดงของสัญลักษณ์ List </h3>
<ul>
<li style "list-style-image :url (Star.png) ">สัญลักษณ์รูปดาว</li>
<li style "list-style-image :url (Star.png) ">สัญลัษณ์วงกลมทึบสีดำ</li>
<li style "list-style-image :url (Star.png) ">สัญลักษณ์สี่เหลี่ยมทึบสีดำ</li>
<li style "list-style-image :url (Star.png) ">สัญลักษณ์วงกลมโปร่งใส</li>
</ul>
</head>
</body>
</html>

ตัวอย่างที่ 4.8

ตัวอย่างที่ 4.8

<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>ทดสอบ Properties font รูปแบบต่างๆ</title>
<style type = "text/css">
<! - -
p.big{ font-size : 12xp;
font-style : italic;
font-family : "Times New Roman", Times,serif;
}
p.small{ font-size : 12xp;
font-weight : bold;
font-family : "courier new", Courier, monospace;
}
-->
</style>
</head>
<body>
<p class = "big">
การทดสอบ Property font ของสไตล์ชีทรูปแบบที่1
</p>
<p class = "small">
การทดสอบ Property font ของสไตล์ชีทรูปแบบที่ 2 พิจารณาการทดสอบรูปแบบนี้เปรียบ เทียบกับแบบแรก
</p>
<h2 style = "font-family: 'Times New Roman' , Times, serif;
Font-size:24px; font-weight:bold">
CSS PROPERTIES
</h2>
</body>
</html>

ตัวอย่างที่ 4.7

ตัวอย่างที่ 4.7

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.W3.orq/1999/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.W3.orq/1999/xhtml1">
<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>การสร้าง link ไฟล์ .css</title>
<! - -
@import url ("style1.css");
-->
</head>
<body>
<h1>การประกาศสไตล์ชีทแบบ"Link"</h1>
<p>การประกาศสไตล์ชีทแบบ"External"คือ สามารถทำได้ 2 วิธี คือ การสร้างจุดเชื่อมโยงด้วย "link" การสร้างจุดเชื่อมโยงด้วย link จะใช้การอ้างถึงไฟล์สไตล์ชีทที่อยู่นอกไฟล์เอกสาร XHTML
</p>
</body>
</html>

ตัวอย่างที่ 4.6

ตัวอย่างที่ 4.5

ตัวอย่างที่ 4.5

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.W3.orq/1999/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.W3.orq/1999/xhtml1">
<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>Untitled Document</title>
<style type = "text/css">
<!—
H2 {font-family: Arial; color:#9900FF;}
P{font-family: Ms Sans Serif; color:#FF8000; ize:10px}
-->
</style>
</head>
<body>
<h2>การประกาศสไตล์ชีทแบบ"Embedded"</h2>
<p>การประกาศสไตล์ชีทแบบ"Embedded"คือ การกำหนดสไตล์ชีทไว้ในแท็กstyle ในส่วนของแท็กhead
ผลลัพธ์จากการกำหนดสไตล์ชีทจะแสดงให้เห็นเม่อมีกรเขียนแท็กจากส่วน body</p>
</body>

</html>

ตัวอย่างที่ 4.4


ตัวอย่างที่ 4.3

ตัวอย่างที่ 4.2

ตัวอย่างที่ 4.1

ตัวอย่างที่ 4.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.W3.orq/1999/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.W3.orq/1999/xhtml1">
<head>
<meta http-equiv = "content-Type" content = "text/html; charset = windows-874"/>
<title>Untitled Document</title>
<style type = "text/css">
<!—
Body { background-color : #00CCFF; }
.style2 {font-size: 24px;
       Font-family: "Courier New" ,Courier,monospace;
         Font-weight: bold;
Coloe: #CC0000;
}
.style3  {Coloe: #9900FF;
 Font-weight : bold;
}
.style4 {Coloe: #000000;}
</style></head>
<body>
<div align = "center" class = "style2" >การออกแบบ wed pages ด้วย CSS </div><p><span class ="style3”> 1.&quot,CSS (Cascading Style Sheet)&quot</span><span class = :"style4">
เทคโนโลยีที่ใช้กำหนดรูปแบบของเอกสารหรือเว็บเพจเพื่อให้สามารถจัดวางตำแหน่งข้อมูลหรือรูปแบบต่างๆ ภายในเอกสารโดย CSS จะแยกส่วนการจัดวาง </span><span class = :style3”>&quot;รูปแบบ(Layout)&quot;</span><span class = "style4">ออกจาก </span><span class = "style3">&quot;เนื้อหา(Content)&quot;</span><span class = "style4">ที่จะแสดงบเว็บเพจ</span></p>
</body>
</html>

ตัวอย่างที่ 3.5

ตัวอย่างที่ 3.5

โค้ด
<?xml version+"1.0"encodeing = "UTF-8"?>
<!--EX3_8.xml-->


<?xml-stylesheet type="text/xsl" href="EX3_8.xml"?>
<product_list>
    <product>
<ID>b001</ID>
<name>การเขียนโปรแกรมภาษาซี</name>
<author>พนิดา พานิชกุล</author>
<ptice>300</price>
    </product>
    <product>
<ID>b002</ID>
<name>HTML เบื้องต้น</name>
<author>กุลชน รักษ์ประเทือง</author>
<ptice>235</price>
    </product>
    <product>
<ID>b003</ID>
<name>Word Search</name>
<author>อ.วิเชียร แป้นไผ่</author>
<ptice>250</price>
    </product>
</product_list>


ผลลัพธ์

b001 การเขียนโปรแกรมภาษาซี พนิดา พานิชกุล 300 b002 HTML เบื้องต้น กุลชน รักษ์ประเทือง 235 b003 Word Search อ.วิเชียร แป้นไผ่ 250 

ตัวอย่างที่ 3.4

ตัวอย่างที่ 3.4

โค้ด

<?xml version+"1.0"encodeing = "iso-8859-1"?>
<!--File Name : DAD_XML.dtd-->

<!DOCTYPE CONTACT[
    <!ELEMENT CONTECT(NAME)>
<!ELEMENT CONTECT(ADDRESS)
    <!ELEMENT ADDDRESS (STREET,DISTRICT,PROVINCE,<!ELEMENT)>
    <!ELEMENT STREET(#PCDATA)>
    <!ELEMENT DISTRICT(#PCDATA)>
    <!ELEMENT PROVINCE(#PCDATA)>
    <!ELEMENT <!ELEMENT(#PCDATA)>
<!ELEMEN CONTECT (TEL) >
]>
<CONTECT>
   <NAME>Kannika</NAME>
   <ADDRESS>
<STREET>TT Road</STREET>
<DISTRICT>Thonburi</DISTRICT>
<PRVINCE>BANGKOK</PRVINCE>
<POST_CODE>10600</POST_CODE>
    </ADDRESS>
    <TEL_TYPE = "OFFICE">02-890-9999</TEL_TYPE>
</Contact>

ผลลัพธ์

]> Kannika
TT Road Thonburi BANGKOK 10600
02-890-9999

ตัวอย่างที่ 3.3

ตัวอย่างที่ 3.3

โค้ด

<?xml version+"1.0"?>
<!--File Name : contact.xml-->

<Contact>
    <NAME>Kannika</NAME>
    <ADDRESS>
<STREET>TT Road</STREET>
<DISTRICT>Thonburi</DISTRICT>
<PRVINCE>BANGKOK</PRVINCE>
<POST_CODE>10600</POST_CODE>
    </ADDRESS>
    <TEL_TYPE = "OFFICE">02-890-9999</TEL_TYPE>
</Contact>

ผลลัพธ์

Kannika
TT Road Thonburi BANGKOK 10600
02-890-9999

ตัวอย่างที่ 3.2

ตัวอย่างที่ 3.2

โค้ด

<?xml version="1.0"?>

<!--File Name : test.xml-->

<product>
    <BOOK>
<TITLE>Design By Web Standard<TITIE>
<author>KANNIKA</author>
    </BOOK>
    -
    -
    <BOOK>
<TITLE> C Programming </TITLE>
<author>SUNISA</author>
<price>250</price>
    </BOOK>
</product>

ผลลัพธ์

SUNISA 250

ตัวอย่างที่ 3.1

ตัวอย่างที่ 3.1

โค้ด
<?xml version+"1.0"?>
<!--EX3_l.xml-->
  <product>
    <ID>001</ID>
    <TYPE>DRINK</TYPE>
    <NAME>PEPSI</NANE>
    <PRICE>13</PRICE>
  </PRODUCT>

ผลลัพธ์

001 DRINK PEPSI 13

ตัวอย่างที่ 2.17

ตัวอย่างที่ 2.17

<HTML>
<HEAD>
   <TITLE>แสดงการสร้างตัวเลือกข้อความรูปแบบต่างๆ</TITLE>
 </HEAD>
   <BODY BGCOLOR = "PINK">
   กรุณาเลือกช่วงอายุของคุณ :<BR>
  <INPUT TYPE="radio" NAME = "age" VALUE = "11-20 ปี" > 11 - 20 ปี
  <INPUT TYPE="radio" NAME = "age" VALUE = "11-20 ปี" > 21 - 30 ปี
  <INPUT TYPE="radio" NAME = "age" VALUE = "11-20 ปี" > 31 - 40 ปี
  <INPUT TYPE="radio" NAME = "age" VALUE = "11-20 ปี" > 41 - 50 ปี
  <HR>
  กรุณาเลือกประเภทนิตยสารที่คุณชื่นชอบ :<BR>
  <INPUT TYPE="checkbox" NAME = "articlel1" VALUE = "บันเทิง" > บันเทิง
  <INPUT TYPE="checkbox" NAME = "articlel2" VALUE = "กีฬา" > กีฬา
  <INPUT TYPE="checkbox" NAME = "articlel3" VALUE = "สารคดี" >สารคดี
  <INPUT TYPE="checkbox" NAME = "articlel4" VALUE = "ท่องเที่ยว" > ท่องเที่ยว
  <HR>
  <INPUT TYPE="reset" VALUE = "ลบข้อมูลทั้งหมด"><BR><BR>
  <INPUT TYPE="submit" NAME = "age" VALUE = "ยืนยันข้อมูล"><BR><BR>
  </BODY>
</HTML>


ผลลัพธ์


ตัวอย่างที่ 2.16

ตัวอย่างที่ 2.16

<HTML>
<HEAD><TITLE>การสร้าง Form โดยใช้ Text Box</TITLE>
</HEAD>
<BODY>
   <FORM>
   <H1>แบบฟอร์ม</H1>
   <H3>ชื่อ : <INPUT TYPE = "text" NAME = "username" SIZE = 25>
    นามสกุล : <INPUT TYPE = "text" NAME = "surname" SIZE = 25 >
   <p>ที่อยู่ :<TEXTAREA NAME= "address" ROWS =6 COLE =80></TEXTAREA></P>
   <P>รหัสไปรษณีย์ : <INPUT TYPE = "text" NAME = "code" SIZE = 5 MAXLENGTH = 5></P>
   <P>จังหวัดที่ท่านอาศัยอยู่ Salect : </H3></p>
      <SELECT NAME = "province" MULTIPLE >
   <OPTION VALUE = กรุงเทพมหานคร > กรุงเทพมหานคร
      <OPTION VALUE = สุพรรณบุรี > สุพรรณบุรี
      <OPTION VALUE = ขอนแก่น > ขอนแก่น
      <OPTION VALUE = เชียงใหม่ > เชียงใหม่
   </SELECT>
   </FORM>
   </BODY>
 </HTML>



ผลลัพธ์