|
|
|
php จะทำให้เช็คค่าว่างเมื่อ admin ไม่ได้กรอกแล้วให้ขึ้นข้อความเตือน |
|
|
|
|
|
|
|
อธิบายเพิ่มเติมครับ
|
|
|
|
|
Date :
2013-03-14 21:25:45 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือให้เช็คครับว่ากรอกข้อมูล subject หรือเปล่าถ้าไม่ได้กรอกให้ขึ้นเตือนและไม่ต้องให้มันส่งค่าอะครับ
คือตอนนี้ให้มันเตือนได้แล้วแต่มันยังแอดค่าว่างไปอยู่อะครับ รบกวนด้วยนะครับคืองานเร่งด่วน
.....ขอบคุณไว้ล่วงหน้าครับ
|
ประวัติการแก้ไข 2013-03-15 10:54:42 2013-03-15 10:54:52 2013-03-15 10:55:49 2013-03-15 10:56:02
|
|
|
|
Date :
2013-03-15 10:52:53 |
By :
jaiboon09 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
session_start();
include('config.php');
error_reporting(0);
if($_SESSION['rh_password'] != $rh_password){
echo "System not allowed access this page.";
die;
}
//Add
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO cf_ass_period ";
$strSQL .="(period_id,year,subject) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtAddperiod_id"]."' ";
$strSQL .=",'".$_POST["txtAddyear"]."' ";
$strSQL .=",'".$_POST["txtAddsubject"]."') ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Save [".mysql_error()."]";
}
if ($_POST["txtAddsubject"]=="") {
alert("กรุณากรอกข้อมูลให้ครบ");
history.restore_exception_handler();
exit;
}
}
//Update
if($_POST["hdnCmd"] == "Update")
{
$strSQL = "UPDATE cf_ass_period SET ";
$strSQL .="period_id = '".$_POST["txtEditperiod_id"]."' ";
$strSQL .=",year = '".$_POST["txtEdityear"]."' ";
$strSQL .=",subject = '".$_POST["txtEditsubject"]."' ";
$strSQL .="WHERE period_id = '".$_POST["hdnEditperiod_id"]."' ";
$objQuery = mysql_query($strSQL);
$strSQL = "UPDATE cf_ass_category SET ";
$strSQL .="period_id = '".$_POST["txtEditperiod_id"]."' ";
$strSQL .="WHERE period_id = '".$_POST["hdnEditperiod_id"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//Delete
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM cf_ass_period WHERE period_id = '".$_GET["period_id"]."' ";
$objQuery = mysql_query($strSQL);
$strSQL = "DELETE FROM cf_ass_member WHERE period_id = '".$_GET["period_id"]."' ";
$objQuery = mysql_query($strSQL);
$strSQL = "DELETE FROM cf_ass_category WHERE period_id = '".$_GET["period_id"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM cf_ass_period";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<!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>Evaluation</title>
<link rel="stylesheet" type="text/css" href="css/register.css" media="screen" title="Innovation Screen Style Sheet" />
<link href="css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/register1.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/check-form.js"></script>
<html>
<head>
</head>
<body>
<form name="frmMain" method="post" action="<?=$_SERVER["PHP_SELF"]; ?>">
<p>
<input type="hidden" name="hdnCmd" value="">
</p>
<p align="center" class="inputText8">แก้ไขหัวข้อการประเมิน</p>
<table width="611" border="1" align="center">
<tr bgcolor="#333333">
<th height="4" bgcolor="#333333"></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th width="91" bgcolor="#333333"> </th>
<th width="91" bgcolor="#FFCCFF"> <div align="center">ลำดับ</div></th>
<th width="98" bgcolor="#FFCCFF"> <div align="center">ปี </div></th>
<th width="97" bgcolor="#FFCCFF"> <div align="center">หัวข้อการประเมิน </div></th>
<th width="97" bgcolor="#FFCCFF"> <div align="center">Edit </div></th>
<th width="97" bgcolor="#FFCCFF"> <div align="center">Delete </div></th>
<th width="97" bgcolor="#333333"> </th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
?>
<?php
if($objResult["period_id"] == $_GET["period_id"] and $_GET["Action"] == "Edit")
{
?>
<tr bgcolor="#CCFFFF">
<td bgcolor="#333333"> </td>
<td><div align="center">
<input type="text" name="txtEditperiod_id" size="5" value="<?=$objResult["period_id"];?>">
<input type="hidden" name="hdnEditperiod_id" size="5" value="<?=$objResult["period_id"];?>"></div></td><td>
<input type="text" name="txtEdityear" size="20" value="<?=$objResult["year"];?>"></td>
<td><div align="center">
<input type="text" name="txtEditsubject" size="80" value="<?=$objResult["subject"];?>"></div></td>
<td colspan="3" align="right"><div align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</div></td>
</tr>
<?php
}
else
{
?>
<tr bgcolor="#CCFFFF">
<td bgcolor="#333333"> </td>
<td><div align="center"><?=$objResult["period_id"];?></div></td>
<td><div align="center"><?=$objResult["year"];?></td>
<td><?=$objResult["subject"];?></td>
<td align="center"><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&period_id=<?=$objResult["period_id"];?>."style="color:#0066FF">Edit</a></td>
<td align="center">
<a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&period_id=<?=$objResult["period_id"];?>';}"style="color:#0066FF">Delete</a></td>
<td align="center" bgcolor="#333333"> </td>
</tr>
<?php
}?>
<?php
}?>
<tr>
<td bgcolor="#333333"> </td>
<td align="center"><input type="text" name="txtAddperiod_id" size="5" /></td>
<td><input type="text" name="txtAddyear" size="20" /></td>
<td><input type="text" name="txtAddsubject" size="80" /></td>
<td colspan="2" align="center">
<input name="btnAdd2" type="button" id="btnAdd" value="Add" onclick="frmMain.hdnCmd.value='Add';frmMain.submit();" /></td>
<td align="right" bgcolor="#333333"> </td>
</tr>
<tr bgcolor="#333333">
<td colspan="7" align="center">
<?php
mysql_close($objConnect);
?>
<div align="center">.</td>
</tr>
</table>
</form>
<br><br>
<form id="form1" name="form1" method="post" action="">
<div align="center"><strong><a href="edit_main.php" style="color:#666666;">Back</a></strong> <strong>| <a href="logout.php" style="color:#666666;">logout</a></strong>
</div>
</form></td>
</tr>
</form>
</body>
</html>
|
|
|
|
|
Date :
2013-03-15 10:53:47 |
By :
jaiboon09 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เงียบเลยแต่ศึกษาเองได้แล้วครับ
|
|
|
|
|
Date :
2013-03-18 11:54:01 |
By :
jaiboon09 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|