|
|
|
ผมจะทำฟอร์มแก้ไขข้อมูลครับช่วยเขียน code ให้ทีครับ ท่านผู้รู้ |
|
|
|
|
|
|
|
Code (PHP)
<?
@session_start();
ob_start();
$useradmin = $_SESSION["useradmin"];
if(empty($useradmin))
{
echo "<script>alert('หน้านี้จำกัดเฉพาะผู้ที่เกี่ยวข้องในระบบเท่านั้น');history.back();</script>";
exit();
}
require_once "../include/tdate.php";
require_once "../include/connectdb.php";
$sql="select * from useradmin where useradmin='$useradmin'";
$db_query=mysql_db_query($db,$sql);
$result=mysql_fetch_array($db_query);
$id=$result[id];
$adminname=$result[name];
$user_admin=$result[useradmin];
$pass_admin=$result[passadmin];
?>
<html>
<head>
<title>:: ระบบบริหารการจัดข้อมูลสมุนไพร ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<!-- Fireworks MX Dreamweaver MX target. Created Sun Jun 12 09:41:17 GMT+0700 (SE Asia Standard Time) 2011-->
<link href="css/style.css" rel="stylesheet" type="text/css">
<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_x.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script>
</head>
<body bgcolor="#ffffff" background="images/bgnew.jpg">
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="Untitled" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
<tr>
<td><img src="images/spacer.gif" width="107" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="128" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="124" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="120" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="109" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="14" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="119" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="127" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="152" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td colspan="5"><img name="index_r1_c1" src="images/index_r1_c1.jpg" width="588" height="102" border="0" alt=""></td>
<td colspan="4" valign="top" background="images/index_r1_c6.jpg">
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td height="16"> <div align="right"><img src="images/topmenu.jpg" width="209" height="27" border="0" usemap="#Map" href="logout.php"></div></td>
</tr>
<tr>
<td><div align="right"><font color="#993333" size="2"><img src="../images/icon_man.gif" width="15" height="15">
<font color="#333333">ยินดีต้อนรับคุณ</font></font><font color="#FFFF00" size="2">
<? echo "<u>$adminname</u>"; ?> <font color="#333333">เข้าใช้งานในระบบ</font></font>
</div></td>
</tr>
</table>
</td>
<td><img src="images/spacer.gif" width="1" height="102" border="0" alt=""></td>
</tr>
<tr>
<td><a href="Main.php"><img name="index_r2_c1" src="images/index_r2_c1.jpg" width="107" height="36" border="0" alt=""></a></td>
<td><a href="Member.php"><img name="index_r2_c2" src="images/index_r2_c2.jpg" width="128" height="36" border="0" alt=""></a></td>
<td><a href="Typeofbook.php"><img name="index_r2_c3" src="images/index_r2_c3.jpg" width="124" height="36" border="0" alt=""></a></td>
<td><a href="Book.php"><img name="index_r2_c4" src="images/index_r2_c4.jpg" width="120" height="36" border="0" alt=""></a></td>
<td colspan="2"><a href="Search.php"><img name="index_r2_c5" src="images/index_r2_c5.jpg" width="123" height="36" border="0" alt=""></a></td>
<td><img name="index_r2_c7" src="images/index_r2_c7.jpg" width="119" height="36" border="0" alt=""></td>
<td><img name="index_r2_c8" src="images/index_r2_c8.jpg" width="127" height="36" border="0" alt=""></td>
<td><img name="index_r2_c9" src="images/index_r2_c9.jpg" width="152" height="36" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="36" border="0" alt=""></td>
</tr>
<tr>
<td colspan="9" bgcolor="#FFFFFF"><div align="center"><br>
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td><div align="center"><font size="2"><a href="Book.php">เพิ่มรายการสมุนไพร</a>
| <a href="BookList.php">รายการสมุนไพรในระบบ</a></font><br>
<table border="0" cellpadding="0" cellspacing="0" width="673">
<!-- fwtable fwsrc="Untitled" fwbase="bxx.jpg" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
<tr>
<td><img src="spacer.gif" width="673" height="1" border="0" alt=""></td>
<td><img src="spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td><img name="bxx_r1_c1" src="../images/bxx_r1_c1.jpg" width="673" height="8" border="0" alt=""></td>
<td><img src="spacer.gif" width="1" height="8" border="0" alt=""></td>
</tr>
<tr>
<td background="../images/bxx_r2_c1.jpg"><script language="JavaScript">
function checkprdtype()
{
var prd1 = document.webFormprdtype.productstypename.value;
if( prd1.length ==0)
{
alert("กรุณาใส่ประเภทสินค้าด้วยค่ะ");
document.webFormprdtype.productstypename.focus();
return false;
}
else
return true;
}
</script>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1">
<form method="post" action="BookSave.php" name="webFormprdtype" onSubmit="return checkprdtype()" enctype="multipart/form-data">
<tr bgcolor="#FFFFFF">
<td><div align="right"><font size="2">ประเภทสมุนไพร
:</font></div></td>
<td><font size="2">
<?php
$sql2 = "select * From typebook";
$result2 = mysql_query($sql2);
$Num_Rows2 = mysql_num_rows($result2);
$result2 = mysql_query($sql2);
echo "<select name=typebookid id=typebookid class=input>";
echo "<option value=0>เลือกประเภทสมุนไพร";
While($row2= mysql_fetch_array($result2)){
$typebookid = $row2["typebookid"];
$typebookname = $row2["typebookname"];
?>
<option value=<? echo "$typebookid"; ?>>-<? echo "$typebookname"; ?>
<?
}
echo "</option></select>";
?>
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="163"> <div align="right"><font size="2">รหัสสมุนไพร
:</font></div></td>
<td width="445"><font size="3">
<?
$sql_numcode="select * from book";
$db_queryr=mysql_db_query($db,$sql_numcode);
$result_numcode=mysql_fetch_array($db_queryr);
$num_rows_code=mysql_num_rows($db_queryr);
$run_number = $num_rows_code+1;
echo "<input type=text name=bookid value='ID-$run_number' class=input>";
?>
</font><font size="2"><img src="images/r.jpg" width="17" height="17"></font><font size="3">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> <div align="right"><font size="2">ชื่อสมุนไพร
:</font></div></td>
<td><font size="3">
<input name="bookname" type="text" class="input" id="bookname" size="40">
</font><font size="2"><img src="images/r.jpg" width="17" height="17"></font><font size="3">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><div align="right"><font size="2"><span lang="th">ชื่อวิทยาศาสตร์</span> :</font></div></td>
<td><font size="3">
<input name="author" type="text" class="input" id="author" size="40">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><div align="right">วงศ์ </div></td>
<td><font size="3">
<input name="bookstation" type="text" class="input" id="bookstation" size="40">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><div align="right"><font size="2">ลักษณะทางพฤกษศาสตร์/สรรพคุณ
:</font></div></td>
<td><font size="3">
<textarea name="bookdetail" cols="40" rows="5" class="input" id="bookdetail"></textarea>
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><div align="right"><font size="2">รูปภาพ</font></div></td>
<td><font size="3">
<input name="bookphoto" type="file" class="input" id="bookphoto" size="40">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
<td><font size="3">
<input name="submit" type="submit" class="submit" value="เพิ่มรายการ" onClick="return confirm ('คุณต้องการบันทึก ใช่ หรือ ไม่? ') ">
</font></td>
</tr>
</form>
</table>
<script language="javascript1.2">
var config = new Object(); // create new config object
config.width = "400px";
config.height = "400px";
config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
config.debug = 0;
// NOTE: You can remove any of these blocks and use the default config!
config.toolbar = [
['fontname'],
['fontsize'],
['fontstyle'],
['linebreak'],
['bold','italic','underline','separator'],
// ['strikethrough','subscript','superscript','separator'],
['justifyleft','justifycenter','justifyright','separator'],
['OrderedList','UnOrderedList','Outdent','Indent','separator'],
['forecolor','backcolor','separator'],
['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
['about','help','popupeditor'],
];
config.fontnames = {
"Arial": "arial, helvetica, sans-serif",
"Courier New": "courier new, courier, mono",
"Georgia": "Georgia, Times New Roman, Times, Serif",
"Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
"Times New Roman": "times new roman, times, serif",
"Verdana": "Verdana, Arial, Helvetica, sans-serif",
"impact": "impact",
"WingDings": "WingDings"
};
config.fontsizes = {
"1 (8 pt)": "1",
"2 (10 pt)": "2",
"3 (12 pt)": "3",
"4 (14 pt)": "4",
"5 (18 pt)": "5",
"6 (24 pt)": "6",
"7 (36 pt)": "7"
};
//config.stylesheet = "http://www.domain.com/sample.css";
config.fontstyles = [ // make sure classNames are defined in the page the content is being display as well in or they won't work!
{ name: "headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
{ name: "arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
{ name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
// leave classStyle blank if it's defined in config.stylesheet (above), like this:
// { name: "verdana blue", className: "headline4", classStyle: "" }
];
editor_generate('bookdetail',config);
</script>
</td>
<td><img src="spacer.gif" width="1" height="20" border="0" alt=""></td>
</tr>
<tr>
<td><img name="bxx_r3_c1" src="../images/bxx_r3_c1.jpg" width="673" height="8" border="0" alt=""></td>
<td><img src="spacer.gif" width="1" height="8" border="0" alt=""></td>
</tr>
</table>
</div></td>
</tr>
</table>
<br>
</div></td>
<td> </td>
</tr>
<tr>
<td colspan="9"><div align="center"><br>
<font size="2"> </font></div></td>
<td> </td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="14,2,105,24" href="Profiles.php">
<area shape="rect" coords="110,1,208,30" href="logout.php">
</map>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2011-12-26 09:45:41 |
By :
Modi |
View :
1031 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยแก้ Code ที่ผมให้มาให้เป็นฟอร์มแก้ไขข้อมูลหน่อยครับ
|
|
|
|
|
Date :
2011-12-26 14:18:49 |
By :
แมค |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|