|
|
|
มีปัญหาเรื่อง การมูฟไฟล์อีกแร้ว ช่วยแก้ค่าให้หน่อยสิ T-T ช่วยทีน๊า |
|
|
|
|
|
|
|
code คุณมันแปลก ๆ น่ะครับ และ input type="file" มันใส่ค่า default value ไม่ได้น่ะครับ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"myfile/".$_FILES["filUpload"]["name"]))
{
echo "Copy/Upload Complete";
}
?>
</body>
</html>
Go to : PHP File Field Upload
|
|
|
|
|
Date :
2011-06-28 12:57:20 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
งี้ควรแทรกตรงไหนดีหรา ขอแนวทางหน่อยจิ T-T ติดอยู่แค่เรื่องเดียวเอง
Code (PHP)
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE boss SET bname=%s, blastname=%s, bposition=%s, images=%s WHERE boss=%s",
GetSQLValueString($_POST['bname'], "text"),
GetSQLValueString($_POST['blastname'], "text"),
GetSQLValueString($_POST['bposition'], "text"),
GetSQLValueString($_POST['images'], "text"),
GetSQLValueString($_POST['boss'], "text"));
mysql_select_db($database_Melody, $Melody);
$Result1 = mysql_query($updateSQL, $Melody) or die(mysql_error());
}
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">ชื่อ</td>
<td><input type="text" name="bname" value="<?php echo htmlentities($row_Recordset1['bname'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">นามสกุล</td>
<td><input type="text" name="blastname" value="<?php echo htmlentities($row_Recordset1['blastname'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ตำแหน่ง</td>
<td><input type="text" name="bposition" value="<?php echo htmlentities($row_Recordset1['bposition'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">รูปภาพ</td>
<td><input type="file" name="images" value="<?php echo htmlentities($row_Recordset1['images'], ENT_COMPAT, 'utf-8');
?>" 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="boss" value="<?php echo $row_Recordset1['boss']; ?>" />
</form>
|
|
|
|
|
Date :
2011-06-28 13:08:15 |
By :
MermaidMelody |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เต็มๆละกาน T-T
Code (PHP)
<?php require_once('../Connections/Melody.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"] == "form1")) {
$updateSQL = sprintf("UPDATE boss SET bname=%s, blastname=%s, bposition=%s, images=%s WHERE boss=%s",
GetSQLValueString($_POST['bname'], "text"),
GetSQLValueString($_POST['blastname'], "text"),
GetSQLValueString($_POST['bposition'], "text"),
GetSQLValueString($_POST['images'], "text"),
GetSQLValueString($_POST['boss'], "text"));
mysql_select_db($database_Melody, $Melody);
$Result1 = mysql_query($updateSQL, $Melody) or die(mysql_error());
}
mysql_select_db($database_Melody, $Melody);
mysql_query("SET NAMES UTF8");
$query_Recordset1 = "SELECT * FROM boss";
$Recordset1 = mysql_query($query_Recordset1, $Melody) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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" />
<style type="text/css">
.textfield {
color: #06C;
text-decoration: none;
background-color: #A1D4E9;
border-top-color: #A1D4E9;
border-right-color: #A1D4E9;
border-bottom-color: #A1D4E9;
border-left-color: #A1D4E9;
}
.word-wrap {
word-wrap: break-word;
}
</style>
<title>Transmission Operation and Maintenance 1</title>
</head>
<body>
<table width="802"><tr><td width="191">
<table width="190" bgcolor="#94D0EA" bordercolor="#A1D4E9" border="1" cellspacing="0" cellpadding="0"><tr><td width="190" height="25" bgcolor="#94D0EA" align="center" background="../images/test.jpg"><div align="left"> <span class="headmenu">หัวหน้าฝ่าย</span></div></td>
</tr>
<tr>
<td height="242" bgcolor="#94D0EA"><div align="center"><br />
<table width="127" height="164" border="1">
<tr>
<td valign="middle" align="center" height="160"><?php echo "<a href='/toam/images/boss/".$row_Recordset1['images']."'>"."<img src='/toam/images/boss/".$row_Recordset1['images']."'width='92%' height='94%'>" ; ?>
</td>
</tr>
</table>
<pre><b><?php echo $row_Boss['bname']." ".$row_Boss['blastname']; ?></b>
<?php echo $row_Boss['bposition']; ?></pre></div></td>
</tr>
</table>
<td width="30"> </td>
<td width="561">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">ชื่อ</td>
<td><input type="text" name="bname" value="<?php echo htmlentities($row_Recordset1['bname'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">นามสกุล</td>
<td><input type="text" name="blastname" value="<?php echo htmlentities($row_Recordset1['blastname'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">ตำแหน่ง</td>
<td><input type="text" name="bposition" value="<?php echo htmlentities($row_Recordset1['bposition'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">รูปภาพ</td>
<td><input type="file" name="images" value="<?php echo htmlentities($row_Recordset1['images'], ENT_COMPAT, 'utf-8');
?>" 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="boss" value="<?php echo $row_Recordset1['boss']; ?>" />
</form>
</td></tr></table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
|
|
|
|
|
Date :
2011-06-28 13:11:09 |
By :
MermaidMelody |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|