|
|
|
เออเร่อ Header location แก้ยังไงหรอครับมันเออเร่อตลอดเลยครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php require_once('Connections/otop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_otop, $otop);
$query_rs_title = "SELECT * FROM webconfig WHERE web_conf_id = 22";
$rs_title = mysql_query($query_rs_title, $otop) or die(mysql_error());
$row_rs_title = mysql_fetch_assoc($rs_title);
$totalRows_rs_title = mysql_num_rows($rs_title);
mysql_select_db($database_otop, $otop);
$query_rs_bg_down = "SELECT * FROM webconfig WHERE web_conf_id = 37";
$rs_bg_down = mysql_query($query_rs_bg_down, $otop) or die(mysql_error());
$row_rs_bg_down = mysql_fetch_assoc($rs_bg_down);
$totalRows_rs_bg_down = mysql_num_rows($rs_bg_down);
mysql_select_db($database_otop, $otop);
$query_rs_bg_web = "SELECT * FROM webconfig WHERE web_conf_id = 23";
$rs_bg_web = mysql_query($query_rs_bg_web, $otop) or die(mysql_error());
$row_rs_bg_web = mysql_fetch_assoc($rs_bg_web);
$totalRows_rs_bg_web = mysql_num_rows($rs_bg_web);
mysql_select_db($database_otop, $otop);
$query_rs_bg_detail_web = "SELECT * FROM webconfig WHERE web_conf_id = 25";
$rs_bg_detail_web = mysql_query($query_rs_bg_detail_web, $otop) or die(mysql_error());
$row_rs_bg_detail_web = mysql_fetch_assoc($rs_bg_detail_web);
$totalRows_rs_bg_detail_web = mysql_num_rows($rs_bg_detail_web);
mysql_select_db($database_otop, $otop);
$query_rs_bg_title = "SELECT * FROM webconfig WHERE web_conf_id = 35";
$rs_bg_title = mysql_query($query_rs_bg_title, $otop) or die(mysql_error());
$row_rs_bg_title = mysql_fetch_assoc($rs_bg_title);
$totalRows_rs_bg_title = mysql_num_rows($rs_bg_title);
$colname_rs_pro_oth = "-1";
if (isset($_GET['pd_id'])) {
$colname_rs_pro_oth = $_GET['pd_id'];
}
mysql_select_db($database_otop, $otop);
$query_rs_pro_oth = sprintf("SELECT * FROM product, product_category, product_type WHERE product.pd_ctg_id = product_category.pd_ctg_id AND product_category.typ_id = product_type.typ_id AND product.pd_id = %s", GetSQLValueString($colname_rs_pro_oth, "int"));
$rs_pro_oth = mysql_query($query_rs_pro_oth, $otop) or die(mysql_error());
$row_rs_pro_oth = mysql_fetch_assoc($rs_pro_oth);
$totalRows_rs_pro_oth = mysql_num_rows($rs_pro_oth);
$colname_rs_cancel = "-1";
if (isset($_GET['pd_id'])) {
$colname_rs_cancel = $_GET['pd_id'];
}
mysql_select_db($database_otop, $otop);
$query_rs_cancel = sprintf("SELECT * FROM product WHERE pd_id = %s", GetSQLValueString($colname_rs_cancel, "int"));
$rs_cancel = mysql_query($query_rs_cancel, $otop) or die(mysql_error());
$row_rs_cancel = mysql_fetch_assoc($rs_cancel);
$totalRows_rs_cancel = mysql_num_rows($rs_cancel);
$queryString_rs_report = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rs_report") == false &&
stristr($param, "totalRows_rs_report") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rs_report = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rs_report = sprintf("&totalRows_rs_report=%d%s", $totalRows_rs_report, $queryString_rs_report);
?><!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"><title><?php echo $row_rs_title['web_conf_desc']; ?></title>
<style type="text/css">
<!--
.style112 {color: #FF0000; font-family: Tahoma, "MS Sans Serif", "Cordia New";font-size: 12px; }
.style113 {color: #4E5203; font-family: Tahoma, "MS Sans Serif", "Cordia New";font-size: 14px; }
.style114{color: #FFFFFF; font-family: Tahoma, "MS Sans Serif", "Cordia New";font-size: 16px; }
.style115 {color: #660000; font-family: Tahoma, "MS Sans Serif", "Cordia New";font-size: 14px; }
.style116 {color: #FF0000; font-family: Tahoma, "MS Sans Serif", "Cordia New";font-size: 14px; }
-->
</style>
<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<? include 'include/admin_menu_left.php'; ?>
</title>
<style type="text/css">
<!--
body {
background-image: url(<?php echo $row_rs_bg_web['web_conf_desc']; ?>);
}
-->
</style>
</head>
<body>
<table width="955" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><? include 'include/admin_header.php'; ?></td>
</tr>
<tr>
<td colspan="2">
<div align="left"><? include 'include/session_login_admin.php'; ?></div></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td valign="top" background="<?php echo $row_rs_bg_detail_web['web_conf_desc']; ?>"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><? include 'include/admin_menu_left.php'; ?></td>
</tr>
</table></td>
<td valign="top" background="<?php echo $row_rs_bg_detail_web['web_conf_desc']; ?>">
<?
mysql_connect("localhost","otop","1234") or die (mysql_error());
mysql_select_db("otop");
for($i=1;$i<=(int)($_POST["hdnMaxLine"]);$i++)
{
$strSQL = "INSERT INTO product_table";
$strSQL .="(pd_ctg_id,pd_title) VALUES ('".$_POST["hd_name"]."','".$_POST["Column1_".$i]."')";
mysql_query($strSQL);
}
mysql_close();
?>
<?
ob_start();
$objConnect = mysql_connect("localhost","otop","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("otop");
//*** Update Condition ***//
for($i=1;$i<=$_POST["hdnLine"];$i++)
{
$strSQL = "INSERT INTO product_property_other";
$strSQL .="(pd_id,pd_tb_id,pd_ctg_id,pd_detail) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["hd_pd$i"]."','".$_POST["hdtable$i"]."','".$_POST["hd_ctg$i"]."', ";
$strSQL .="'".$_POST["txtName$i"]."') ";
$objQuery = mysql_query($strSQL);
}
header("location:admin_product_category_detail.php");
//header("location:$_SERVER[PHP_SELF]");
//exit();
$strSQL = "SELECT * FROM product_table WHERE pd_ctg_id = '".$_POST["hd_name"]."'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form action="" method="post" name="frmMain" id="frmMain">
<br />
<table width="535" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#330000">
<tr>
<td height="15" colspan="6" background="<?php echo $row_rs_bg_title['web_conf_desc']; ?>" class="style114"><div align="center">เพิ่มรายละเอียดตามคุณสมบัติ</div></td>
</tr>
<tr>
<td height="15" colspan="6" class="style114"><span class="style113">หมวด : </span><span class="style115"><?php echo $row_rs_pro_oth['typ_name']; ?></span><span class="style113"> ประเภท : </span><span class="style115"><?php echo $row_rs_pro_oth['pd_ctg_name']; ?></span><span class="style113"> ชื่อ : </span><span class="style115"><?php echo $row_rs_pro_oth['pd_name']; ?></span></td>
</tr>
<tr>
<td width="218" background="<?php echo $row_rs_bg_detail_web['web_conf_desc']; ?>"><div align="center" class="style113">รายการคุณสมบัติ </div></td>
<td colspan="5" background="<?php echo $row_rs_bg_detail_web['web_conf_desc']; ?>"><div align="center" class="style113">รายละเอียดผลิตภัณฑ์</div></td>
</tr>
<?
$i =0;
while($objResult = mysql_fetch_array($objQuery))
{
$i = $i + 1;
?>
<tr>
<td background="<?php echo $row_rs_bg_detail_web['web_conf_desc']; ?>"><input name="hd_ctg<?=$i;?>" type="hidden" id="hd_ctg<?=$i;?>" value="<?=$objResult["pd_ctg_id"];?>" size="5" />
<? echo $objResult["pd_title"]; ?>
<input type="hidden" name="hdtable<?=$i;?>" value="<?=$objResult["pd_tb_id"];?>" />
<input name="hd_pd<?=$i;?>" type="hidden" id="hd_pd<?=$i;?>" value="<?php echo $row_rs_cancel['pd_id']; ?>" /></td>
<td width="366" background="<?php echo $row_rs_bg_detail_web['web_conf_desc']; ?>"><div align="center">
<input type="text" name="txtName<?=$i;?>" size="20" value="" />
</div></td>
</tr>
<?
}
?>
<tr>
<td colspan="2"><div align="center" class="style116">ไม่มีรายการคุณสมบัติ</div></td>
</tr>
<tr>
<td colspan="2" background="<?php echo $row_rs_bg_down['web_conf_desc']; ?>"><div align="center">
<input name="cmbcancle3" type="button" id="cmbcancle3" onclick="MM_goToURL('parent','admin_product_add_three.php?pd_id=<?php echo $row_rs_cancel['pd_id']; ?>');return document.MM_returnValue" value="กลับไปหน้ารายละเอียด" />
<input type="submit" name="submit" value="ตกลง" />
<label>
<input name="cmbcancle" type="button" id="cmbcancle" onclick="MM_goToURL('parent','admin_product_add_three.php?pd_id=<?php echo $row_rs_cancel['pd_id']; ?>');return document.MM_returnValue" value="ยกเลิก" />
</label>
</div></td>
</tr>
</table>
<input type="hidden" name="hdnLine" value="<?=$i;?>" />
</form>
<?
mysql_close($objConnect);
?>
</td>
</tr>
<tr>
<td colspan="2" valign="top"><? include 'include/footer.php'; ?></td>
</tr>
<tr>
<td width="200" valign="top"><table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"></td>
</tr>
</table></td>
<td width="755" valign="top"> </td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rs_title);
mysql_free_result($rs_bg_down);
mysql_free_result($rs_bg_web);
mysql_free_result($rs_bg_detail_web);
mysql_free_result($rs_bg_title);
mysql_free_result($rs_pro_oth);
mysql_free_result($rs_cancel);
?>
ผมวางob_start(); แล้วมันก็ยังเออเร่ออยู่อะครับ แต่ถ้าวางบนสุดเลยตรงไฟล์connect มันจะไม่ผ่านหน้านี้เลยอะครับมันจะไปหน้าlocation เลย
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-02-11 23:35:47 |
By :
potkung11 |
View :
990 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ob_start ต้องอยู่บรรทัดแรกครับ
|
|
|
|
|
Date :
2012-02-12 00:04:04 |
By :
ikikkok |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมลองเอาไว้บรรทัดแรกแล้วครับ พอจะเข้ามาหน้านี้มันเด้งไปหน้า Location เลยอะครับ
|
|
|
|
|
Date :
2012-02-12 01:09:09 |
By :
potkung11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเปลี่ยนจาก header เป็นCode (PHP)
echo "<script>window.location("url")</script>";
หรือ
ใส่ meta - refresh ก็ได้ครับ
|
|
|
|
|
Date :
2012-02-12 08:28:08 |
By :
asustak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|