สอบถามเรื่องการเลือกสถานะและแสดงข้อมูลค่ะ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา สอบถามเรื่องการเลือกสถานะและแสดงข้อมูลค่ะ

สอบถามเรื่องการเลือกสถานะและแสดงข้อมูลค่ะ
สอบถามเรื่องการเลือกสถานะ 2 สถานะคือ ตาย กับ มีชีวิตอยู่ ต้องการให้แสดงข้อมูลแค่ผู้ที่มีชีวิตอยู่ หากเลือกตายจะไม่แสดงข้อมูลต้องทำยังไงคะ
หน้าที่เลือกสถานะ update.php


<?php require_once('../Connections/MyConnect.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "../adminlogin/index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?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_update"])) && ($_POST["MM_update"] == "form1")) {
	$bDay=$_POST['p_birthday'];
	list($day, $month, $year)=split('[/.-]',$bDay);
	if($_POST['p_status']=="ตาย"){
		$dDay=$_POST['p_dead'];
		list($dDay, $dMonth, $dYear)=split('[/.-]',$dDay);
	}
	else {
			$dDay="00";
			$dMonth="00";
			$dYear="0000";
		}  
    $updateSQL = sprintf("UPDATE people SET titlename=%s, p_name=%s, p_lastname=%s, p_birthday=%s, p_money=%s, p_address=%s, p_group=%s, p_status=%s, p_dead=%s WHERE p_idcard=%s",
	                   GetSQLValueString($_POST['titlename'], "text"),
                       GetSQLValueString($_POST['p_name'], "text"),
					   GetSQLValueString($_POST['p_lastname'], "text"),
                       GetSQLValueString(sprintf("%s-%s-%s",$year,$month,$day), "date"),
                       GetSQLValueString($_POST['p_money'], "int"),
                       GetSQLValueString($_POST['p_address'], "text"),
                       GetSQLValueString($_POST['p_group'], "text"),
                       GetSQLValueString($_POST['p_status'], "text"),
                       GetSQLValueString(sprintf("%s-%s-%s",$dYear,$dMonth,$dDay), "date"),
                       GetSQLValueString($_POST['p_idcard'], "text"));

  mysql_select_db($database_MyConnect, $MyConnect);
  $Result1 = mysql_query($updateSQL, $MyConnect) or die(mysql_error());

  $updateGoTo = "data-table.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

$colname_Recordset1 = "-1";
if (isset($_GET['p_idcard'])) {
  $colname_Recordset1 = $_GET['p_idcard'];
}
mysql_select_db($database_MyConnect, $MyConnect);
$query_Recordset1 = sprintf("SELECT * FROM people WHERE p_idcard = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $MyConnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../menu/menu.css">
<link rel="stylesheet" type="text/css" href="../datetimepicker-master/jquery.datetimepicker.css">
<title>update</title>
<style type="text/css">
body {
	background-color: #333;
}
#page #menulinks a span {
	color: #000000;
}
body,td,th {
	color: #000000;
}
a:link {
	color: #3333FF;
}
a:hover {
	color: #CC3399;
}
</style>


<script>
  function chkupd(){
              if(confirm('คุณต้องการแก้ไขข้อมูลใช่หรือไม่ ?')){
                     return true; // ถ้าตกลง OK โปรแกรมก็จะทำงานต่อไป 
              }else{
                     return false; // ถ้าตอบ Cancel ก็คือไม่ต้องทำอะไร 
              }
       }

	</script>
</head>
<body>
<div id="page">
	<div id="header">
			<h1>ระบบฐานข้อมูลผู้สูงอายุองค์การบริหารส่วนตำบลโก่งธนู			</h1>
			<div class="description">
			  <p>Senior Database of Kong Thanu Subdistrict  Administrative   Organization </p>
</div>
	</div>
    <div id="menulinks">
        <a href="home.php"><span>หน้าหลัก</span></a>
		<a class="active" href="data-table.php"><span>ทะเบียนประวัติ</span></a>
		<a href="insert.php"><span>เพิ่มข้อมูลใหม่</span></a>
		<a href="appear_mon.php"><span>บันทึกการรับเบี้ยยังชีพ</span></a>
		<a href="report.php"><span>ใบสำคัญการรับเงิน</span></a>
        <a href="<?php echo $logoutAction ?>"><span>Logout</span></a>
       ยินดีต้อนรับคุณ : <? echo $_SESSION["user"];?>
	</div>	
<div id="mainarea">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<center>
  <p>&nbsp;</p>
</center>
  <table border="1" align="center" cellpadding="3" cellspacing="0">
  <tr valign="baseline">
      <td colspan="2" align="center" nowrap="nowrap" bgcolor="#FF9966"><h3>&nbsp;</h3>
        <h3>แก้ไขข้อมูล</h3>
        <p>&nbsp;</p></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">เลขที่บัตรประจำตัวประชาชน :</td>
      <td bgcolor="#FFCCCC"><?php echo $row_Recordset1['p_idcard']; ?></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap bgcolor="#FFCCCC">คำนำหน้าชื่อ :</td>
     
          <td bgcolor="#FFCCCC"><input type="radio" name="titlename" value="นาย" <?php if (!(strcmp(htmlentities($row_Recordset1['titlename'], ENT_COMPAT, 'utf-8'),"นาย"))) {echo "checked="checked"";} ?>>
            นาย
       
          <input type="radio" name="titlename" value="นาง" <?php if (!(strcmp(htmlentities($row_Recordset1['titlename'], ENT_COMPAT, 'utf-8'),"นาง"))) {echo "checked="checked"";} ?>>
            นาง
        
          <input type="radio" name="titlename" value="นางสาว" <?php if (!(strcmp(htmlentities($row_Recordset1['titlename'], ENT_COMPAT, 'utf-8'),"นางสาว"))) {echo "checked="checked"";} ?>>
            นางสาว</td>
        </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">ชื่อจริง  :</td>
      <td bgcolor="#FFCCCC"><input type="text" name="p_name" value="<?php echo htmlentities($row_Recordset1['p_name'], ENT_COMPAT, 'utf-8'); ?>" size="30" onKeyUp="if(!(isNaN(this.value))) { alert('กรุณากรอกเฉพาะตัวอักษร'); this.value='';}"/></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">นามสกุล  :</td>
      <td bgcolor="#FFCCCC"><input type="text" name="p_lastname" value="<?php echo htmlentities($row_Recordset1['p_lastname'], ENT_COMPAT, 'utf-8'); ?>" size="30" onKeyUp="if(!(isNaN(this.value))) { alert('กรุณากรอกเฉพาะตัวอักษร'); this.value='';}"/></td>
    </tr> 
    
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  

<script src="../datetimepicker-master/jquery.datetimepicker.js"></script>
<script src="../datetimepicker-master/moment.min.js"></script>  

<script type="text/javascript">
$(function(){
 
    $("#birthday").datetimepicker
	({
        format:'d-m-Y',  // กำหนดรูปแบบวันที่ ที่ใช้ เป็น 00-00-0000
        lang:'th',  // แสดงภาษาไทย
        yearStart:1914,
		yearEnd:1954,  // ช่วงเลือกปีเริ่มต้น ใช้ ค.ศ.
        yearOffset:543, // ใช้ปี พ.ศ. บวก 543 เพิ่มเข้าไปในปี ค.ศ
		timepicker:false,  // กำหนด ไม่แสดงตัวเลือกเวลา
        onSelectDate:function(){  // ถ้าเลือกวันแล้ว 
    $("#birthday").datetimepicker('hide'); // ให้ซ่อน datetimepicker
        },       
    });
//    
    $("#birthday").on("change",function(){
        var dayBirth=$(this).val();
        var getdayBirth=dayBirth.split("-");
        var YB=getdayBirth[2]-543;
        var MB=getdayBirth[1];
        var DB=getdayBirth[0];
        
		var setdayBirth=moment(YB+"-"+MB+"-"+DB);  
        var setNowDate=moment();
        var yearData=setNowDate.diff(setdayBirth, 'years', true); // ข้อมูลปีแบบทศนิยม
        var yearFinal=Math.round(setNowDate.diff(setdayBirth, 'years', true),0); // ปีเต็ม
        var yearReal=setNowDate.diff(setdayBirth, 'years'); // ปีจริง
        var monthDiff=Math.floor((yearData-yearReal)*12); // เดือน
        var str_year_month=yearReal+" ปี "+monthDiff+" เดือน"; // ต่อวันเดือนปี
        $("#age").val(str_year_month);
       
	    var moneyData=0;
        if(yearData>=90){
            moneyData=1000;
        }else if(yearData>=80){
            moneyData=800;
        }else if(yearData>=70){
            moneyData=700;
        }else if(yearData>=60){
            moneyData=600;
        }else{
	       alert("ผู้สูงอายุต้องอายุตั้งแต่ 60 ขึ้นไปกรุณากรอกใหม่อีกครั้ง !");	
        }
        $("#money").val(moneyData);
    });  
});
 $(function() {
	  $( "#datedead" ).datetimepicker
	  ({
        format:'d-m-Y',  // กำหนดรูปแบบวันที่ ที่ใช้ เป็น 00-00-0000
        lang:'th',  // แสดงภาษาไทย
        yearStart:1914,  // ช่วงเลือกปีเริ่มต้น ใช้ ค.ศ.
        yearOffset:543, // ใช้ปี พ.ศ. บวก 543 เพิ่มเข้าไปในปี ค.ศ
		maxDate: '-1Y', // เห็น ว ด ป ถึงแค่ปัจจุบัน ไม่เกินปันจุบัน
		timepicker:false,  // กำหนด ไม่แสดงตัวเลือกเวลา
        onSelectDate:function(){  // ถ้าเลือกวันแล้ว 
    $("#datedead").datetimepicker('hide'); // ให้ซ่อน datetimepicker
        },       
    });
});   
</script>     
	
 <?php  
     $mydate= $row_Recordset1['p_birthday'];  // วันที่ที่มี ปีเป็นปี พ.ศ.
// แยก วัน เดือน ปี เป็น array เพื่อเอาค่ามาต่อเป็นรูปแบบวันที่ใหม่ เป็นปี ค.ศ.
     $arr_date=explode("-",$mydate); 
// สร้างรูปแบบวันที่ใหม่ ปี ค.ศ. 
    $new_date=($arr_date[0]-543)."-".$arr_date[1]."-".$arr_date[2]; // จะได้ 1915-11-03
// แต่ถ้าอยากใช้เป็นปี พ.ศ. เหมือนเดิม ก็ใช้ค่าปีจากตัวแปรเดิม
    $new_formatDateTh=date("d-m-".$arr_date[0],strtotime($new_date)); 	
	
	$mydate=$row_Recordset1['p_dead'];  // วันที่ที่มี ปีเป็นปี พ.ศ.
// แยก วัน เดือน ปี เป็น array เพื่อเอาค่ามาต่อเป็นรูปแบบวันที่ใหม่ 
    $arr_date=explode("-",$mydate); 

// จัดรูปแบบแบบง่าย หรือก็คือย้ายตำแหน่งเลย
    $new_deadDate=$arr_date[2]."-".$arr_date[1]."-".$arr_date[0]; // จัดรูปแบบวันที่ใหม่ 
 ?>
     <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">วัน/เดือน/ปีเกิด ผู้สูงอายุ :</td>
      <td bgcolor="#FFCCCC"><input type="type" name="p_birthday" id="birthday" size="15" value="<?php echo htmlentities( $new_formatDateTh, ENT_COMPAT, 'utf-8'); ?>">
      <tr>
       <?php 
  	$bDay=$row_Recordset1['p_birthday'];
	$tmp=split('[/.-]',$bDay);
	$current_year=date("Y")+543;
	$age=$current_year-$tmp[0];
      ?>   
      
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">  อายุจริง : </td> 
      <td bgcolor="#FFCCCC"><input type="text" id="age" size="7" readonly value="<?php echo htmlentities($row_Recordset1['age'], ENT_COMPAT, 'utf-8'); ?>"></td>
      </tr>
   
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">จำนวนเงิน :</td>
      <td bgcolor="#FFCCCC"><input name="p_money" type="text" id="money" value="<?php echo htmlentities($row_Recordset1['p_money'], ENT_COMPAT, 'utf-8'); ?>" size="7" readonly /> บาท</td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">บ้านเลขที่ :</td>
      <td bgcolor="#FFCCCC"><input type="text" name="p_address" value="<?php echo htmlentities($row_Recordset1['p_address'], ENT_COMPAT, 'utf-8'); ?>" size="20" onKeyUp="if(isNaN(this.value)){ alert('กรุณากรอกเลข !'); this.value='';}"/></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">หมู่ที่  :</td>
      <td bgcolor="#FFCCCC"><input type="text" name="p_group" value="<?php echo htmlentities($row_Recordset1['p_group'], ENT_COMPAT, 'utf-8'); ?>" size="5" onKeyUp="if(isNaN(this.value)){ alert('กรุณากรอกเลข !'); this.value='';}"/></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" bgcolor="#FFCCCC">สถานะภาพ  :</td>
      <td bgcolor="#FFCCCC"><select name="p_status" onChange="showDead(this)">
        <option value="มีชีวิตอยู่" <?php if (!(strcmp("มีชีวิตอยู่", htmlentities($row_Recordset1['p_status'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>>มีชีวิตอยู่</option>
        <option value="ตาย" <?php if (!(strcmp("ตาย", htmlentities($row_Recordset1['p_status'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>>ตาย</option>
      </select></td>
    </tr>
    <script>
     function showDead(o){
	 if(o.value=="ตาย"){
	  document.getElementById("deadDate").hidden=false;
		 }
	else{
	  document.getElementById("deadDate").hidden=true;
		}
	 }
     </script>

    <tr valign="baseline" id="deadDate">
<td align="right" nowrap="nowrap" bgcolor="#FFCCCC">วันที่ตาย  :</td>
      <td bgcolor="#FFCCCC"><input type="text" name="p_dead" id="datedead" size="15" value="<?php echo htmlentities($new_deadDate, ENT_COMPAT, 'utf-8'); ?>"/></td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="center" nowrap="nowrap" bgcolor="#FFCCCC"><p>&nbsp;
        </p>
        <p>
          <input type="submit" value="บันทึก" onClick="return confirm('คุณต้องการแก้ไขข้อมูลนี้หรือไม่ ?')" />
          
      </p>
        <p>&nbsp;</p></td>
    </tr>
    
  </table>
  <p>
    <input type="hidden" name="MM_update" value="form1" />
    <input type="hidden" name="p_idcard" value="<?php echo $row_Recordset1['p_idcard']; ?>" />
  </p>
  <p>&nbsp;</p>
</form>
</div>
<div id="footer">ระบบฐานข้อมูลผู้สูงอายุองค์การบริหารส่วนตำบลโก่งธนู อำเภอเมือง จังหวัดลพบุรี</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>


Yoyo 180.183.166.xxx 12-01-2015 20:49:43

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

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


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


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
หน้าแสดงข้อมูล

<?php require_once('../Connections/MyConnect.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}
 
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
 
  $logoutGoTo = "../adminlogin/index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?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_update"])) && ($_POST["MM_update"] == "form1")) {
 
$bDay=$_POST['date_money'];
list($aday, $amonth, $ayear)=split('[/.-]',$bDay);
 
  $updateSQL = sprintf("UPDATE people SET status_money=%s, date_money=%s WHERE p_idcard=%s",
                       GetSQLValueString($_POST['status_money'], "text"),
                       GetSQLValueString(sprintf("%s-%s-%s",$ayear,$amonth,$aday), "date"),
                       GetSQLValueString($_POST['p_idcard'], "text"));
 
  mysql_select_db($database_MyConnect, $MyConnect);
  $Result1 = mysql_query($updateSQL, $MyConnect) or die(mysql_error());
 
  $updateGoTo = "appear_mon.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
 
mysql_select_db($database_MyConnect, $MyConnect);
$query_Recordset2 = "SELECT * FROM people";
$Recordset2 = mysql_query($query_Recordset2, $MyConnect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);$colname_Recordset2 = "-1";
if (isset($_GET['p_idcard'])) {
  $colname_Recordset2 = $_GET['p_idcard'];
}
mysql_select_db($database_MyConnect, $MyConnect);
$query_Recordset2 = sprintf("SELECT * FROM people WHERE p_idcard = %s", GetSQLValueString($colname_Recordset2, "text"));
$Recordset2 = mysql_query($query_Recordset2, $MyConnect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!DOCTYPE>
<html>
<head>
<title>การรับเงิน</title>
<link rel="stylesheet" type="text/css" href="../menu/menu.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../datetimepicker-master/jquery.datetimepicker.css">
<style type="text/css">
body {
 
background-color: #333;
}
#page #menulinks a span {
color: #000000;
}
body,td,th {
color: #000000;
}
a:link {
color: #3333FF;
}
a:hover {
color: #CC3399;
}
</style>
 
</head>
 
<body>
 
<div id="page">
<div id="header">
<h1>ระบบฐานข้อมูลผู้สูงอายุองค์การบริหารส่วนตำบลโก่งธนู </h1>
<div class="description">
 <p>Senior Database of Kong Thanu Subdistrict  Administrative   Organization </p>
</div>
</div>
 <div id="menulinks">
        <a href="home.php"><span>หน้าหลัก</span></a>
<a href="data-table.php"><span>ทะเบียนประวัติ</span></a>
<a href="insert.php"><span>เพิ่มข้อมูลใหม่</span></a>
<a class="active" href="appear_mon.php"><span>บันทึกการรับเบี้ยยังชีพ</span></a>
        <a href="report.php"><span>ใบสำคัญการรับเงิน</span></a>
        <a href="<?php echo $logoutAction ?>"><span>Logout</span></a>
        ยินดีต้อนรับคุณ : <? echo $_SESSION["user"];?>
</div>
 
<div id="mainarea">
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
        <table border="1" align="center" cellpadding="3" cellspacing="0">
        <tr valign="baseline">
            <td colspan="2" align="center" nowrap bgcolor="#FF9966"><p>&nbsp;</p>
              <h3>รายการการรับเบี้ยยังชีพ</h3>
            <p>&nbsp;</p></td>
          </tr>
          <tr valign="baseline">
            <td align="right" nowrap bgcolor="#FFCCCC">เลขที่บัตรประจำตัวประชาชน  :</td>
            <td bgcolor="#FFCCCC"><?php echo $row_Recordset2['p_idcard']; ?></td>
          </tr>
          <tr valign="baseline">
            <td align="right" nowrap bgcolor="#FFCCCC">สถานะการรับเบี้ยบังชีพ  :</td>
            <td bgcolor="#FFCCCC"><select name="status_money">
              <option value="รับเบี้ยยังชีพ" <?php if (!(strcmp("รับเบี้ยยังชีพ", htmlentities($row_Recordset2['status_money'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>>รับเบี้ยยังชีพ</option>
              <option value="ไม่แสดงตน" <?php if (!(strcmp("ไม่แสดงตน", htmlentities($row_Recordset2['status_money'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>>ไม่แสดงตน</option>
              
            </select></td>
          </tr>
         
 
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
 
<script src="../datetimepicker-master/jquery.datetimepicker.js"></script>
<script src="../datetimepicker-master/moment.min.js"></script>  
 
<script type="text/javascript">
$(function(){
 
    $("#date_m").datetimepicker  
    ({  
        format:'d-m-Y',   
        lang:'th',    
        yearStart:1914,  
        yearOffset:543,
maxDate: '-1Y',    
        timepicker:false,   
        onSelectDate:function(){     
    $("#date_m").datetimepicker('hide');   
        },         
    });  
    
    var nowSelect=$("select[name='status_money'] option:selected").val();
    if(nowSelect=='ไม่แสดงตน'){
        alert("ผู้รับเบี้ยยังชีพไม่แสดงตน !");
        $("#date_m").prop("disabled","disabled");
    }else{
        $("#date_m").prop("disabled","");
    }
    $("select[name='status_money']").on("change",function(){
        var nowSelect=$("select[name='status_money'] option:selected").val();
        if(nowSelect=='ไม่แสดงตน'){
            alert("ผู้รับเบี้ยยังชีพไม่แสดงตน !");
            $("#date_m").prop("disabled","disabled");
        }else{
            $("#date_m").prop("disabled","");
        }        
    });
 
    
});
</script>      
<?php
         $mydate=$row_Recordset2['date_money']; //วันรับเงิน 
         $arr_date=explode("-",$mydate); 
         $new_dateMon=$arr_date[2]."-".$arr_date[1]."-".$arr_date[0];
?>
           <tr valign="baseline">
            <td align="right" nowrap bgcolor="#FFCCCC">วันที่รับเงินเบี้ยยังชีพ  :</td>
            <td bgcolor="#FFCCCC"><pre><input type="text" name="date_money" id="date_m" value="<?php echo htmlentities($new_dateMon, ENT_COMPAT, 'utf-8'); ?>" > * กรณีรับเบี้ยยังชีพ</pre></td>
          </tr>
          <tr valign="baseline">
            <td colspan="2" align="center" nowrap bgcolor="#FFCCCC"><p>&nbsp;
              </p>
              <p>
                <input type="submit" value="submit" onClick="return confirm('บันทึกข้อมูลนี้หรือไม่ ?')">
            </p></td>
          </tr>
        </table>
        <input type="hidden" name="MM_update" value="form1">
        <input type="hidden" name="p_idcard" value="<?php echo $row_Recordset2['p_idcard']; ?>">
      </form>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
  </div>
 
    <div id="footer">ระบบฐานข้อมูลผู้สูงอายุองค์การบริหารส่วนตำบลโก่งธนู อำเภอเมือง จังหวัดลพบุรี</div>
</div>
 
</body>
 
</html>
<?php
mysql_free_result($Recordset2);
?>
 


yoyo 180.183.166.xxx 12-01-2015 20:51
 ความคิดเห็นที่ 2
ดูเนื้อหานี้เป็นแนวทาง

แนวทาง การค้นหาจาก หลายรูปแบบ และแบ่งหน้า อย่างง่าย 


ninenik 171.96.10.xxx 13-01-2015






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ