รบกวนถามในช่องแก้ไขข้อมูลมันขึ้น <br /><b>Warning</b>: htmlentities ครับ
Code (PHP)
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0" style="border:2px solid #dc030c">
<tr>
<td height="33" id="head_box"> </td>
</tr>
<tr>
<td>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Id:</td>
<td><?php echo $row_sellcar['id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Selldate:</td>
<td><input type="text" name="selldate" value="<?php echo htmlentities($row_sellcar['selldate'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Sell_member:</td>
<td><input type="text" name="sell_member" value="<?php echo htmlentities($row_sellcar['sell_member'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">No:</td>
<td><input type="text" name="no" value="<?php echo htmlentities($row_sellcar['no'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Brand:</td>
<td><input type="text" name="brand" value="<?php echo htmlentities($row_sellcar['brand'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Model:</td>
<td><input type="text" name="model" value="<?php echo htmlentities($row_sellcar['model'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Year:</td>
<td><input type="text" name="year" value="<?php echo htmlentities($row_sellcar['year'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Gear:</td>
<td><input type="text" name="gear" value="<?php echo htmlentities($row_sellcar['gear'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Color:</td>
<td><input type="text" name="color" value="<?php echo htmlentities($row_sellcar['color'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Price:</td>
<td><input type="text" name="price" value="<?php echo htmlentities($row_sellcar['price'], ENT_COMPAT, 'windows-874'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Update record" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="id" value="<?php echo $row_sellcar['id']; ?>" />
</form>
<p> </p></td>
</tr>
</table>
Date :
2015-07-17 13:30:11
By :
วีระพล
ลองลบข้างล่างนี้ดูครับ ได้มั้ย
Code (PHP)
, ENT_COMPAT, 'windows-874'
Date :
2015-07-17 14:47:33
By :
littlebeer
ช่องที่ว่าเป็นภาษาไทยใช่มั้ย ลองใส่
Code (PHP)
<meta charset="utf-8">
ใน tag head ดูครับ ถ้าไม่หายคงต้องดูฐานข้อมูลว่าเป็น utf-8 มั้ย แล้วโค้ดคิวรี่ charset utf-8 มั้ย
Date :
2015-07-17 15:50:23
By :
littlebeer
ลองเปลี่ยนตามแล้วไม่ได้ครับพี่รบกวนดูให้ทีครับ อันนี้โค๊ดทั้งหมดครับผม ฐานข้อมูลผมตั้งไว้เป็น tis620_thai_ci ครับ
Code (PHP)
<?php require_once('../Connections/connection.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_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE sell SET selldate=%s, sell_member=%s, `no`=%s, type=%s, brand=%s, model=%s, `year`=%s, gear=%s, color=%s, cost=%s, price=%s, status=%s WHERE id=%s",
GetSQLValueString($_POST['selldate'], "date"),
GetSQLValueString($_POST['sell_member'], "text"),
GetSQLValueString($_POST['no'], "text"),
GetSQLValueString($_POST['type'], "int"),
GetSQLValueString($_POST['brand'], "text"),
GetSQLValueString($_POST['model'], "text"),
GetSQLValueString($_POST['year'], "int"),
GetSQLValueString($_POST['gear'], "text"),
GetSQLValueString($_POST['color'], "text"),
GetSQLValueString($_POST['cost'], "text"),
GetSQLValueString($_POST['price'], "text"),
GetSQLValueString($_POST['status'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
$updateGoTo = "sell.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE sell SET selldate=%s, sell_member=%s, `no`=%s, brand=%s, model=%s, `year`=%s, gear=%s, color=%s, price=%s WHERE id=%s",
GetSQLValueString($_POST['selldate'], "date"),
GetSQLValueString($_POST['sell_member'], "text"),
GetSQLValueString($_POST['no'], "text"),
GetSQLValueString($_POST['brand'], "text"),
GetSQLValueString($_POST['model'], "text"),
GetSQLValueString($_POST['year'], "int"),
GetSQLValueString($_POST['gear'], "text"),
GetSQLValueString($_POST['color'], "text"),
GetSQLValueString($_POST['price'], "text"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
$updateGoTo = "sell.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_connection, $connection);
$query_sellcar = "SELECT * FROM sell";
$sellcar = mysql_query($query_sellcar, $connection) or die(mysql_error());
$row_sellcar = mysql_fetch_assoc($sellcar);
$totalRows_sellcar = mysql_num_rows($sellcar);
session_start(); //ประกาศใช้ session
//เรียกใช้ไฟล์ config.ini.php
include "../config.ini.php";
//ตรวจสอบการเข้าสู่ระบบ
$st=1; // สถานะการเข้าสู่ระบบ 1=ยังไม่ได้ login 2=login เข้าระบบแล้ว
if (isset($_SESSION["sess_id"])!="") {
$st=2;
$uid=$_SESSION["sess_userid"]; //รับค่าตัวแปร id ของลูกค้าจาก session
$uname=$_SESSION["sess_name"]; //รับค่าตัวแปร ชื่อ-นามสกุล ของลูกค้าจาก session
$sess_id=$_SESSION["sess_id"]; //รับค่าตัวแปรก session_id
$utype=$_SESSION["sess_type"];
} else { mws_message('กรุณาเข้าสู่ระบบ','index.php'); }
$sql=" select * from car where id=$_GET[id_edit] ";
$result=mysql_query($sql);
$rs=mysql_fetch_array($result);
?>
<!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=windows-874" />
<title><?php echo $sys_title; ?></title>
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<link rel="stylesheet" type="text/css" href="css/start/jquery-ui-1.8.21.custom.css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script language="javascript">
$ (function() {
$("#bdate").datepicker({
dateFormat: 'dd-mm-yy',
dayNamesMin: ['อา', 'จ', 'อ', 'พ', 'พฤ', 'ศ', 'ส'],
monthNamesShort: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'],
changeMonth: true,
changeYear: true ,
yearRange: 'c-50:c+0'
});
});
function chk_form() {
var Rtn=true;
if (document.getElementById("no").value=="" || document.getElementById("year").value=="" ||
document.getElementById("color").value=="" || document.getElementById("price").value=="") {
Rtn=false;
alert('กรุณาป้อนข้อมูลให้ครบ');
}
return Rtn;
}
</script>
</head>
<body>
<div id="header">
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="222"><div align="center"><img src="../images/logo.png" width="164" height="110" /></div></td>
<td width="778"> <font size="+4" color="#FFFFFF"><?php echo $sys_title; ?></font></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><?php include "menu.php"; ?></td>
</tr>
</table>
</div>
<div id="container">
<table width="900" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="69"><div align="center"><img src="../images/icon/settings.png" width="32" height="32" /></div></td>
<td width="687"> <font size="+2">แก้ไขข้อมูลการขาย</font></td>
<td width="136"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
</table>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0" style="border:2px solid #dc030c">
<tr>
<td height="33" id="head_box"> </td>
</tr>
<tr>
<td>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table width="700" align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">รหัส:</td>
<td><?php echo $row_sellcar['id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">วันที่ขาย:</td>
<td><input type="text" name="selldate" value="<?php echo htmlentities($row_sellcar['selldate']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ผู้ซื้อ:</td>
<td><input type="text" name="sell_member" value="<?php echo htmlentities($row_sellcar['sell_member']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">เลขทะเบียน:</td>
<td><input type="text" name="no" value="<?php echo htmlentities($row_sellcar['no']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ยี่ห้อ:</td>
<td><input type="text" name="brand" value="<?php echo htmlentities($row_sellcar['brand']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">รุ่น:</td>
<td><input type="text" name="model" value="<?php echo htmlentities($row_sellcar['model']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ปี:</td>
<td><input type="text" name="year" value="<?php echo htmlentities($row_sellcar['year']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">สี:</td>
<td><input type="text" name="color" value="<?php echo htmlentities($row_sellcar['color']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ราคาขาย:</td>
<td><input type="text" name="price" value="<?php echo htmlentities($row_sellcar['price']); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="แก้ไข" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="id" value="<?php echo $row_sellcar['id']; ?>" />
</form>
<p> </p></td>
</tr>
</table>
<p> </p>
<p> </p>
</div>
</body>
</html>
<?php
mysql_free_result($sellcar);
?>
Date :
2015-07-17 16:19:29
By :
วีระพล
ฐานข้อมูลลองใช้เป็น utf-8 ดูครับ
Date :
2015-07-17 19:46:03
By :
littlebeer
Load balance : Server 02