 |
สอบถามเรื่องส่งตัวแปร GET จากหน้า test.php ไปหน้า SalesCompare_2014 |
|
 |
|
|
 |
 |
|
อยากให้ส่งค่าจาก หน้า test.php ไป หน้า SalesCompare_2014.php
test.php
ตัวแปรที่ต้องการส่งคือ $aa
Code (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FusionCharts graph</title>
<link rel="stylesheet" href="style.css">
<script language="javascript" src="Charts/FusionCharts.js"></script>
<style type="text/css">
.sss {
text-align: center;
}
.sss {
font-family: Tahoma, Geneva, sans-serif;
font-size: 24px;
}
body {
margin-left: 0px;
margin-top: 1px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
text-decoration: none;
color: #333;
}
a:visited {
text-decoration: none;
color: #333;
}
a:hover {
text-decoration: none;
color: #333;
}
a:active {
text-decoration: none;
color: #333;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<table width="37%" border="0" align="center" cellpadding="1" cellspacing="1" class="sss">
<tr>
<td align='left' valign="middle" bgcolor="#FFFFFF">Model_Graph 2014</td>
</tr>
<tr>
<td align="center" class="table">
<center><div id="chart5Div">This text is replaced by chart.</div></center>
<script type="text/javascript">
var chart2 = new FusionCharts("Charts/FCF_MSLine.swf", "ChId1", "850", "430");
chart2.setDataURL("Data/SalesCompare_2014.php");
chart2.render("chart5Div");
</script></td>
</tr>
<tr>
<td align="center" class="table"><table width="949" border="0" align="center" cellspacing="0" class="table">
<tr>
<td width="53" align="center" valign="middle" class="table">/td>
<td width="89" align="center" valign="middle"><a href="http://666666.com/Dashboard/index_2014.php?aa=2014">Model 2014</a></td>
</tr>
</table></td>
</tr>
</table>
<CENTER>
</CENTER>
</body>
</html>
SalesCompare_2014.php
Code (PHP)
<?php
//connect.php
//function random
function rgb2hex($r, $g, $b, $uppercase=false, $shorten=false)
{
// The output
$out = "";
// If shorten should be attempted, determine if it is even possible
if ($shorten && ($r + $g + $b) % 17 !== 0) $shorten = false;
// Red, green and blue as color
foreach (array($r, $g, $b) as $c)
{
// The HEX equivalent
$hex = base_convert($c, 10, 16);
// If it should be shortened, and if it is possible, then
// only grab the first HEX character
if ($shorten) $out .= $hex[0];
// Otherwise add the full HEX value (if the decimal color
// is below 16 then we have to prepend a 0 to it)
else $out .= ($c < 16) ? ("0".$hex) : $hex;
}
// Package and away we go!
return $uppercase ? strtoupper($out) : $out;
}
//โค๊ด random สีกราฟ
echo "<graph numdivlines='4' lineThickness='3' showValues='0' numVDivLines='10' formatNumberScale='2' rotateNames='1' decimalPrecision='2' anchorRadius='2' anchorBgAlpha='0' numberPrefix='' divLineAlpha='30' showAlternateHGridColor='1' yAxisMinValue='800000' shadowAlpha='50' >";
echo "<categories>";
// เดือน 12 เดือน ----->>
$aa="2014";//ค่านี้อยากให้ให้ส่งมาจาก หน้า test.php
$strQueryData = "SELECT DISTINCT order_date, SUM( size_new ) AS V_TOTAL_new, DATE_FORMAT( order_date, '%$aa-%m' ) AS Mydate, check_status, order_generation AS V_TOTAL2_
FROM `data_1`
WHERE DATE_FORMAT( order_date, '%Y' ) = '$aa'
GROUP BY DATE_FORMAT( order_date, '%Y-%m' ) ASC ";
$resultData = mysql_query($strQueryData) or die(mysql_error());
while($arr=mysql_fetch_array($resultData)){
echo "<category Name='".$arr[Mydate]."'/>";
}
echo "</categories>";
// Model 14 Model----------->>>>
$strQueryData_new = "SELECT DISTINCT order_date, SUM( size_new ) AS V_TOTAL_new, DATE_FORMAT( order_date, '%$aa-%m' ) AS Mydate, check_status, order_generation AS V_TOTAL2_
FROM `data_1`
WHERE DATE_FORMAT( order_date, '%Y' ) = '$aa'
GROUP BY order_generation ";
$resultData_new = mysql_query($strQueryData_new) or die(mysql_error());
while($arr_new=mysql_fetch_array($resultData_new)){
$name_ =$arr_new['V_TOTAL2_'];
echo "<dataset seriesName='".$arr_new[V_TOTAL2_]."' color='".rgb2hex(rand(0, 255), rand(0, 255), rand(0, 255), true)."' anchorBorderColor='F6BD0F' anchorRadius='4'>";
// ผลรวม sum model ทุก เดือน --------------->>
$strQueryData_new_1 = "SELECT DISTINCT order_date , SUM( size_new ) AS V_TOTAL_new , DATE_FORMAT( order_date, '%$aa-%m' ) AS Mydate , order_generation AS V_TOTAL2_
FROM `data_1`
WHERE DATE_FORMAT( order_date, '%Y' ) = '$aa' AND order_generation='$arr_new[V_TOTAL2_]'
GROUP BY DATE_FORMAT( order_date, '%$aa-%m') ";
$resultData_new_1 = mysql_query($strQueryData_new_1) or die(mysql_error());
while($arr_new_1=mysql_fetch_array($resultData_new_1)){
$Mydate=$arr_new_1['Mydate'];
$V_TOTAL2_=$arr_new_1['V_TOTAL2_'];
$V_TOTAL_new=$arr_new_1['V_TOTAL_new'];
echo "<set value='".$arr_new_1['V_TOTAL_new'] / 10000 ."'/>";
}
echo "</dataset>";
}
echo "</graph>";
?>
Tag : PHP, Action Script, Ajax, jQuery
|
ประวัติการแก้ไข 2017-06-16 14:34:47 2017-06-16 14:36:05
|
 |
 |
 |
 |
Date :
2017-06-16 14:33:57 |
By :
sawmon |
View :
758 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$aa=$_GET['aa'];
ศึกษา php ตั้งแต่เริ่มต้น ก่อนที่จะเขียนจริง ก็จะดีนะครับ แบบ basic php ไม่ดีเอาเลย
|
 |
 |
 |
 |
Date :
2017-06-17 08:37:19 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<td width="89" align="center" valign="middle"><a href="http://666666.com/Dashboard/index_2014.php?aa=2014">Model 2014</a></td>
สีแดงมันไม่ใช่ SalesCompare_2014.php
ต้องเอา ?aa=2014 ไปไว้ข้างล่างสีน้ำเงิน หรือเปล่า
<center><div id="chart5Div">This text is replaced by chart.</div></center>
48.<script type="text/javascript">
49.var chart2 = new FusionCharts("Charts/FCF_MSLine.swf", "ChId1", "850", "430");
50.chart2.setDataURL("Data/SalesCompare_2014.php");
51.chart2.render("chart5Div");
52.</script></td>
|
 |
 |
 |
 |
Date :
2017-06-17 19:46:22 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|