ช่วยด้วยค่ะ อัพรูปไม่ขึ้น เป็นกากบาทสีแดง
โพสต์แล้ว: 05/04/2012 2:15 am
โค้ด: เลือกทั้งหมด
<?
ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:index.php');
exit();
}
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล
require_once('../connect/connect.php');
require_once('../connect/function.php');
//=========== กรณีมีการแก้ไขรายการข่าว
if($_GET["Action"]=="Save")
{
//=========== บันทึกข้อมูลข่าว
$sql_up = "update news set NewsCode='$_POST[txtNewsCode]',NewsName='$_POST[txtNewsName]',Description='$_POST[txtDescription]',Promotion='$_POST[rdoPromotion]',New='$_POST[rdoNew]' where NewsID='$_GET[NewsID]'";
$dbquery_up = mysql_query($sql_up)or die(mysql_error());
//echo $sql_up;
// exit();
//=========== แก้ไขไฟล์เล็ก
if(!empty($file))
{
$path="../picture";
//=========== อัพโหลตไฟลืเล็ก
@copy( $file ,"$path/$file_name");
// @move_uploaded_file() move_uploaded_file($_FILES['file1']['tmp_name'], 'newpath/file.ext');
$sql_up = "update news set Picture='$filUpload' where NewsID='$_GET[NewsID]'";
$dbquery_up = mysql_query($sql_up)or die(mysql_error());
}
echo"<script language='JavaScript'>";
echo"alert('แก้ไขข้อมูลเรียบร้อยแล้ว');";
echo"window.location='editNews.php?NewsID=$_GET[NewsID]';";
echo"</script>";
}
?>
<html>
<title>..:: ระบบจัดการฐานข้อมูล ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../css/styles.css" type="text/css">
<script language="JavaScript" src="editor.js"></script>
<style type="text/css">
body,td,th {
font-family: "Microsoft Sans Serif", "MS Sans Serif", sans-serif;
}
</style>
<div align="center"><br>
<?
//=========== อ่านว่าคือสินค้าชนิดใด
$result=select("news","where 1=1 and NewsID='".$_GET["NewsID"]."'");
if(!$result)
{
header("location:News.php");
}
?>
<table cellspacing=1 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
<table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="35%" bgcolor="#FFFFFF"> <div align="left"><b><img src="../image/allrowto.gif" width="11" height="11" align="absbottom">
แก้ไขรายการข่าว</b></div></td>
<td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left">
</div></td>
<td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="News.php?CatID=<?=$result["CatID"];?>">กลับไป</a></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</div>
<form name="frm<?=$i;?>" method="post" action="<?=$_SERVER['PHP_SELF'];?>?NewsID=<?=$_GET["NewsID"];?>&Action=Save" enctype="multipart/form-data" onSubmit="return checkvalue()">
<table cellspacing=1 cellpadding=3 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="31" bgcolor="#FFFFFF"> <script language="Javascript1.2"><!-- // load htmlarea
_editor_url = ""; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script>
<script language="JavaScript">
function checkvalue()
{
if(parseInt(document.all.txtPrice.value) >= parseInt(document.all.txtPriceNormal.value))
{
alert('ราคาพิเศษจะต้องน้อยกว่ากว่าราคาปกติ');
document.all.txtPrice.focus();
return false;
}else
{ return true; }
}
</script>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="20%"> </td>
<td width="80%"> </td>
</tr>
<tr>
<td valign="top">รหัสข่าว <font color="#FF0000">** </font></td>
<td><input name="txtNewsCode" type="text" class="txtbox" id="V" value="<?=$result["NewsCode"];?>" maxlength="20" readonly="true">
</td>
</tr>
<tr>
<td valign="top">ข่าวที่น่าสนใจ <font color="#FF0000">** </font></td>
<td><input name="rdoPromotion" type="radio" value="Yes" <? if($result["Promotion"]=="Yes"){?>checked<?}?>>
ใช่
<input type="radio" name="rdoPromotion" value="No" <? if($result["Promotion"]=="No"){?>checked<?}?>>
ไม่ใช่</td>
</tr>
<tr>
<td valign="top">ข่าวใหม่<font color="#FF0000">** </font></td>
<td><input name="rdoNew" type="radio" value="Yes" <? if($result["New"]=="Yes"){?>checked<?}?>>
ใช่
<input type="radio" name="rdoNew" value="No" <? if($result["New"]=="No"){?>checked<?}?>>
ไม่ใช่</td>
</tr>
<tr>
<td valign="top">ชื่อข่าว <font color="#FF0000">** </font></td>
<td><input name="txtNewsName" type="text" class="txtbox" id="txtNewsName" style="width:550" value="<?=$result["NewsName"];?>" maxlength="255"></td>
</tr>
<tr>
<td valign="top">รูปภาพ <font color="#FF0000">** </font></td>
<td><img src="../picture/<?=$result["Picture"];?>" /></td>
</tr>
<tr>
<td valign="top"> </td>
<td><input name="file" type="file" class="txtbox" id="filUpload"></td>
</tr>
<tr>
<td valign="top">รายละเอียด <font color="#FF0000">** </font></td>
<td><textarea name="txtDescription" cols="40" rows="10" class="txtbox" id="txtDescription" style="width:550; height:450"><?=$result["Description"];?></textarea>
<script language="javascript1.2">
editor_generate('txtDescription');
</script> </td>
</tr>
<tr>
<td></td>
<td><input name="Submit" type="submit" class="button" value="บันทึก">
<input name="Cancel" type="button" class="button" id="Cancel" value="ยกเลิก" onClick="window.location='News.php?CatID=<?=$result["CatID"];?>';"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</tbody>
</table>
<table cellspacing=0 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
<table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="35%" bgcolor="#FFFFFF"> <div align="left"></div></td>
<td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left">
</div></td>
<td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="News.php?CatID=<?=$result["CatID"];?>">กลับไป</a></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</form>