|
|
|
วิธีแก้โค็ด ให้เตื่อนเวลากรอกช่องใดช่องนึงไม่ครบ เพราะผมใช้ อัตโนมัติ ของโปรแกรม dreamweaver cs6 |
|
|
|
|
|
|
|
Code (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 = "../User/LoginPage.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_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO manufacturing (ProductId, `Date`, ProductTotal, Detailedstorage) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['NBuy'], "int"),
GetSQLValueString($_POST['Mdata'], "date"),
GetSQLValueString($_POST['Munittatal'], "int"),
GetSQLValueString($_POST['MDetailedstorage'], "text"));
mysql_select_db($database_MyConnect, $MyConnect);
$Result1 = mysql_query($insertSQL, $MyConnect) or die(mysql_error());
$insertGoTo = "manufacturing.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_MyConnect, $MyConnect);
$query_Recordset1 = "SELECT * FROM manufacturing";
$Recordset1 = mysql_query($query_Recordset1, $MyConnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_MyConnect, $MyConnect);
$query_Recordset2 = "SELECT * FROM product";
$Recordset2 = mysql_query($query_Recordset2, $MyConnect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!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="<?php echo $editFormAction; ?>">
<table width="1114" height="83" border="1">
<tr>
<th scope="row"> </th>
</tr>
</table>
<table width="1113" height="332" border="1">
<tr>
<th width="167" scope="row"><a href="../User/Master.php">ถอยกลับ</a></th>
<td width="728" rowspan="2"><p>
<label for="NBuy">ชื่อสินค้า</label>
<select name="NBuy" id="NBuy" title="<?php echo $row_Recordset2['ProductName']; ?>">
<?php
do {
?>
<option value="<?php echo $row_Recordset2['ProductId']?>"><?php echo $row_Recordset2['ProductName']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select>
</p>
<p>
<label for="MTotal">จำนวนทข้าวเปลือกที่สามารถนำมาผลิตได้</label>
<input name="MTotal" type="text" disabled="disabled" id="MTotal" value="<?php echo $row_Recordset1['ProductTotal']; ?>" />
กิโลกรัม </p>
<p id="MData">
<label for="MDATA">วันที่ผลิต</label>
<input name="Mdata" type="text" disabled="disabled" id="Mdata" value="<?php echo date('m/d/y');?>"/>
</p>
<p>
<label for="Munittatal">จำนวนที่ต้องการผลิต</label>
<input name="Munittatal" type="text" id="Munittatal" />
กระสอบ
* 50 กิโลกรัมต่อ 1 กระสอบ</p>
<p>
<label for="MDetailedstorage">วิธีเก็บรักษา</label>
<textarea name="MDetailedstorage" id="MDetailedstorage" cols="45" rows="5"></textarea>
</p>
<p>
<input type="submit" name="btnma" id="btnma" value="ผลิต" />
</p>
<p> </p>
<p> </p>
<p> </p></td>
<td width="196" rowspan="2"> </td>
</tr>
<tr>
<th scope="row"><a href="<?php echo $logoutAction ?>">ออกจากระบบ</a></th>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
?>
Tag : MySQL, HTML, XAMPP
|
|
|
|
|
|
Date :
2017-05-19 10:38:33 |
By :
bassnaruto |
View :
776 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JavaScript HTML Check Input TextBox/Text Field
|
|
|
|
|
Date :
2017-05-19 16:27:00 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
http://www.ninenik.com/content.php?arti_id=579 อันนี้ ง่ายครับ
|
|
|
|
|
Date :
2017-05-22 10:24:39 |
By :
you_jack |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|