|
|
|
ช่วยดูหน่อยค่ะ แอดข้อมูลไม่ลง ช่วยหน่อยค่ะ ++++++++ |
|
|
|
|
|
|
|
หน้า form เพิ่มข้อมูล
Code (PHP)
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
session_start();
require_once('../Connection/config.php'); ?>
<!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>Adminitrator</title>
<link href="Acss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="mainall">
<div class="banner">aaaa</div>
<div class="main">
<table width="100%">
<tr>
<td width="26%" valign="top">
<div id='cssmenu'>
<ul>
<li><a href="index1.php"><span>หน้าหลัก</span></a></li>
<li><a href='#'><span>จัดการสมาชิก</span></a></li>
<li><a href='movie.php'><span>จัดการภาพยนตร์</span></a></li>
<li><a href='#'><span>ตรวจสอบรายการจอง</span></a></li>
<li><a href="#"><span>รายงานแจ้งการชำระเงิน</span></a></li>
<li class='last'><a href="../logout.php" class="style1"><span>ออกจากระบบ</span></a></li><?=$_SESSION[MM_Username];?>
</ul>
</div>
</td>
<td width="74%" valign="top">
<div class="right">
<span class="text">ภาพยนตร์</span>
<br />
<iframe id="uploadtarget" name="uploadtarget" src="" style="width:0px;height:0px;border:0"></iframe>
<form id="AddPForm" method="post" enctype="multipart/form-data" action="Addproduct.php" onsubmit="return senddata();" target="uploadtarget">
<h3>
<p align="center" class="text">เพิ่มข้อมูลภาพยนตร์ </p>
</h3>
<table width="500" border="0" align="center" class="text">
<tr>
<td width="127" valign="top">รหัส :</td>
<td width="363"><div align="left">
<input name="mov_id" type="text" id="mov_id" size="50" />
</div></td>
</tr>
<tr>
<td valign="top">ชื่อเรื่อง :
<label for="textfield"></label></td>
<td><div align="left">
<input name="mov_name" type="text" id="mov_name" size="50" />
</div></td>
</tr>
<tr>
<td valign="top">เรื่องย่อ :
<label for="label"></label></td>
<td><div align="left">
<textarea name="mov_detail" cols="40" rows="10" id="mov_detail"></textarea>
</div></td>
</tr>
<tr>
<td valign="top">ตัวอย่างหนัง : </td>
<td><div align="left">
<input name="mov_vdo" type="text" id="mov_vdo" size="50" />
</div></td>
</tr>
<tr>
<td valign="top">โปสเตอร์หนัง : </td>
<td><div align="left">
<input name="mov_pic" type="file" id="mov_pic" size="35" />
</div></td>
</tr>
<tr>
<td valign="top"> </td>
<td></td>
</tr>
<tr>
<td valign="top"> </td>
<td><div align="left">
<input name="submit" type="submit" value="submit" id="submit"/>
<input type="reset" name="Reset" value="Reset" id="Reset" />
</div></td>
</tr>
</table>
<p align="center">
<label for="Submit"></label>
</p>
</form>
</td>
</tr>
</table>
</div>
<div class="footer">footter</div>
</body>
</html>
หน้าโค๊ดเพิ่มข้อมูล
Code (PHP)
<?php
include ("../Connection/config.php");
$realname = $HTTP_POST_FILES['mov_pic']['name'];
$str=substr($realname,-3,3);
if (is_uploaded_file($HTTP_POST_FILES['mov_pic']['tmp_name']) )
{
copy($HTTP_POST_FILES['mov_pic']['tmp_name'], "./image/mov/$realname");
$Url="image/mov/$realname";
$Filename=$HTTP_POST_FILES['mov_pic']['name'];
$size=$HTTP_POST_FILES['mov_pic']['size']/1024/1024;
$size1=number_format($size,3);
} else{
echo " Upload not complete";
} ;
$sql=" INSERT INTO movie (mov_id,mov_name,mov_detail,mov_pic,mov_vdo) values ('$mov_id','$mov_name','$mov_detail','$Url','$mov_vdo')";
mysql_db_query($database_config,"SET NAMES utf-8");
$sqlquery=mysql_db_query($database_config,$sql) or die("äÁèÊÒÁÒöà¾ÔèÁ¢éÍÁÙÅä´é ¡ÃسҵÃǨÊͺ¢éÍÁÙÅÍÕ¡¤ÃÑé§");
mysql_close();
print"à¾ÔèÁ¢éÍÁÙÅàÃÕºÃéÍÂáÅéÇ";
?>
<script language="JavaScript">
<!--
window.parent.AddOk('<?=$mov_name?>');
//-->
</script>
พอกดปุ่มเพิ่มแล้ว form ไม่ไปค่ะ แอดไม่ลง
พอเพิ่มข้อมูลสำเร็จอยากให้กลับมาหน้านี้ค่ะ
Code (PHP)
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
session_start();
require_once('../Connection/config.php'); ?>
<!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>Adminitrator</title>
<link href="Acss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="mainall">
<div class="banner">aaaa</div>
<div class="main">
<table width="100%">
<tr>
<td width="26%">
<div id='cssmenu'>
<ul>
<li><a href="index1.php"><span>หน้าหลัก</span></a></li>
<li><a href='#'><span>จัดการสมาชิก</span></a></li>
<li><a href='movie.php'><span>จัดการภาพยนตร์</span></a></li>
<li><a href='#'><span>ตรวจสอบรายการจอง</span></a></li>
<li><a href="#"><span>รายงานแจ้งการชำระเงิน</span></a></li>
<li class='last'><a href="../logout.php" class="style1"><span>ออกจากระบบ</span></a></li><?=$_SESSION[MM_Username];?>
</ul>
</div>
</td>
<td width="74%" valign="top">
<div class="right">
<span class="text">ภาพยนตร์</span>
<br />
<br />
<table>
<tr>
<td class="text"><form action="add_movie.php" method="post"><a href="add_movie.php">เพิ่มภาพยนตร์</a></form></td>
</tr>
</table>
<?
include ("../Connection/config.php");
$sql = "SELECT * FROM `movie`";
$result = mysql_query($sql);
echo
"<table width='75%' class='text' bgcolor='#999999'>
<tr align='center'>
<td></td>
<td>รหัส</td>
<td>ชื่อ</td>
<td>เรื่องย่อ</td>
<td>ตัวอย่างหนัง</td>
</tr>";
while($row=mysql_fetch_array($result)){
$mov_id = $row["mov_id"];
$mov_name = $row["mov_name"];
$mov_detail = $row["mov_detail"];
$mov_pic = $row["mov_pic"];
$mov_vdo = $row["mov_vdo"];
echo "<tr align='center'>";
echo "<td>'$mov_pic'</td>";
echo "<td>'$mov_id'</td>";
echo "<td>'$mov_name'</td>";
echo "<td>'$mov_detail'</td>";
echo "<td>'$mov_vdo'</td>";
echo "</tr>";
}
echo "</table>"; ?>
</div>
</td>
</tr>
</table>
</div>
<div class="footer">footter</div>
</body>
</html>
อันนี้เป็นฐานข้อมูลค่ะ
ช่วยหน่อยนะค่ะ
Tag : PHP, MySQL, HTML/CSS
|
ประวัติการแก้ไข 2013-11-17 21:18:28
|
|
|
|
|
Date :
2013-11-17 21:15:28 |
By :
badtzyui |
View :
738 |
Reply :
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง
Code (PHP)
var_dump($sql); die();
หลังหน้าโค๊ดเพิ่มข้อมูลบรรทัดที่ 16 แล้วแปะค่าที่ได้มาหน่อยครับ
|
|
|
|
|
Date :
2013-11-17 22:58:12 |
By :
itpcc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ต้อง insert mov_id ลองดู
|
|
|
|
|
Date :
2013-11-18 09:21:36 |
By :
anotherdie |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วเมื่อกดadd แล้ว อยากให้เปลี่ยนหน้ามาอีกหน้านนึงต้องทำยังไงค่ะ
อยากให้เปลี่ยนมาหน้านี้ค่ะ
Code (PHP)
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
session_start();
require_once('../Connection/config.php'); ?>
<!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>Adminitrator</title>
<link href="Acss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="mainall">
<div class="banner">aaaa</div>
<div class="main">
<table width="100%">
<tr>
<td width="26%">
<div id='cssmenu'>
<ul>
<li><a href="index1.php"><span>หน้าหลัก</span></a></li>
<li><a href='#'><span>จัดการสมาชิก</span></a></li>
<li><a href='movie.php'><span>จัดการภาพยนตร์</span></a></li>
<li><a href='#'><span>ตรวจสอบรายการจอง</span></a></li>
<li><a href="#"><span>รายงานแจ้งการชำระเงิน</span></a></li>
<li class='last'><a href="../logout.php" class="style1"><span>ออกจากระบบ</span></a></li><?=$_SESSION[MM_Username];?>
</ul>
</div>
</td>
<td width="74%" valign="top">
<div class="right">
<span class="text">ภาพยนตร์</span>
<br />
<br />
<table>
<tr>
<td class="text"><form action="add_movie.php" method="post"><a href="add_movie.php">เพิ่มภาพยนตร์</a></form></td>
</tr>
</table>
<?
include ("../Connection/config.php");
$sql = "SELECT * FROM `movie`";
$result = mysql_query($sql);
echo
"<table width='75%' class='text' bgcolor='#999999'>
<tr align='center'>
<td></td>
<td>รหัส</td>
<td>ชื่อ</td>
<td>เรื่องย่อ</td>
<td>ตัวอย่างหนัง</td>
</tr>";
while($row=mysql_fetch_array($result)){
$mov_id = $row["mov_id"];
$mov_name = $row["mov_name"];
$mov_detail = $row["mov_detail"];
$mov_pic = $row["mov_pic"];
$mov_vdo = $row["mov_vdo"];
echo "<tr align='center'>";
echo "<td>'$mov_pic'</td>";
echo "<td>'$mov_id'</td>";
echo "<td>'$mov_name'</td>";
echo "<td>'$mov_detail'</td>";
echo "<td>'$mov_vdo'</td>";
echo "</tr>";
}
echo "</table>"; ?>
</div>
</td>
</tr>
</table>
</div>
<div class="footer">footter</div>
</body>
</html>
|
|
|
|
|
Date :
2013-11-18 11:24:38 |
By :
badtzyui |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
หน้าเดิม ตรง form ดูเรื่อง action ....
จะเกี่ยวไหมครับ
|
|
|
|
|
Date :
2013-11-18 11:29:15 |
By :
apisitp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
งง
|
|
|
|
|
Date :
2013-11-18 14:43:06 |
By :
badtzyui |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมก็งง code ของคุณเหมือนกันครับ งง เหมือนกัน เสมอกันครับ
|
|
|
|
|
Date :
2013-11-18 17:06:49 |
By :
apisitp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตกลงว่า insert ได้แล้ว? แล้วอยากเปลี่ยนหน้า? ถามถามยังไม่เคลียร์เลยครับ
|
|
|
|
|
Date :
2013-11-18 17:31:58 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|