Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ผมอยากให้ file form and file action มันอยู่หน้าเดียวกัน



 

ผมอยากให้ file form and file action มันอยู่หน้าเดียวกัน

 



Topic : 002174

Guest




คือว่าผมต้องการทำหน้า page ที่ประกอบด้วย form menuselect.php อยู่ด้านบนของ page และ file chart.php (Action) อยู่ด้านล่าง ต่อจากส่วนของ file menuselect.php ปัญหาก็คือ file chart.php ซึ่งเป็น รูปภาพที่เกิดจากการ generate ของ script ภายใน chart.php จะแสดงรูปที่เป็น สี่เหลี่ยม ที่ยังไม่มีเส้นกราฟแต่อย่างไร เพราะว่ายังไม่ได้รับค่าจากการ submit จาก file menuselect.php แต่พอเรา submit จาก file menuselect.php แทนที่รูปภาจาก file chart.php จะปรากฏที่ด้านล่างต่อจาก file menuselect.php มันกลับไปเปิดหน้าใหม่ ไม่รู้จะทำยังไงดี ช่วยผมหน่อย ไม่เอาวิธีการแบ่งเป็น frame นะ
<?php
include ('menuselect.php');
include ('chart.php); //header("Content-type: image/png");
?>





Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 11 ธ.ค. 2547 10:42:52 By : gundam View : 3255 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

สำหรับการจัดตำแหน่งของใช้ Table เข้ามาช่วยนะครับ
สำหรับ ไฟล์

include ('chart.php); //header("Content-type: image/png");

มีการส่ง header มาเป็น image/png อาจจะใช้ร่วมกับ function include ไม่ได้ครับ
เพราะในหน้าที่เรียกมีการส่งเป็น text/html






Date : 11 ธ.ค. 2547 15:50:59 By : @W_IN
 


 

No. 2

Guest


เฉลยครับ ตอนนี้ทำได้แล้ว ไปดูตัวอย่าง sorce code กันเลย
[File: phpdemo/dbdemo1_main.php".] //Form ส่งค่า

<html>
<body>
<h1>Database Integration Demo (1)</h1>
<p>The example demonstrates creating a chart using data from a database.</p>

<ul>
<li><a href="viewsource.php?file=<?php echo $HTTP_SERVER_VARS["SCRIPT_NAME"] ?>">
View containing HTML page source code
</a></li>
<li><a href="viewsource.php?file=dbdemo1a.php">
View chart generation page source code
</a></li>
</ul>

<form action="<?php echo $HTTP_SERVER_VARS["SCRIPT_NAME"] ?>">
I want to obtain the revenue data for the year
<select name="year">
<option value="1990">1990
<option value="1991">1991
<option value="1992">1992
<option value="1993">1993
<option value="1994">1994
<option value="1995">1995
<option value="1996">1996
<option value="1997">1997
<option value="1998">1998
<option value="1999">1999
<option value="2000">2000
<option value="2001">2001
</select>
<input type="submit" value="OK">
</form>

<?php
if (isset($HTTP_GET_VARS["year"]))
$SelectedYear = $HTTP_GET_VARS["year"];
else
$SelectedYear = 2001;
?>

<SCRIPT>
//make sure the select box displays the current selected year.
document.forms[0].year.selectedIndex = <?=$SelectedYear - 1990?>;
</SCRIPT>

<img src="dbdemo1a.php?year=<?php echo $SelectedYear ?>">

</body>
</html>


[File: phpdemo/dbdemo1a.php".] //รับค่า
<?php
require_once("../lib/phpchartdir.php");

#
#Displays the monthly revenue for the selected year. The selected year
#should be passed in as a query parameter called "year"
#
if (isset($HTTP_GET_VARS["year"]))
$SelectedYear = $HTTP_GET_VARS["year"];
else
$SelectedYear = 2001;

#
#Create an SQL statement to get the revenues of each month for the
#selected year.
#
$SQLstatement = "Select Month(TimeStamp) - 1, Software, Hardware, Services " .
"From revenue Where Year(TimeStamp)=" . $SelectedYear;

#
#Read in the revenue data into arrays
#
mysql_connect("localhost", "test", "test");
$result = mysql_db_query("sample", $SQLstatement);
$software = array_pad(array(), 12, 0);
$hardware = array_pad(array(), 12, 0);
$services = array_pad(array(), 12, 0);
while ($row = mysql_fetch_row($result)) {
$software[$row[0]] = $row[1];
$hardware[$row[0]] = $row[2];
$services[$row[0]] = $row[3];
}

#
#Now we obtain the data into arrays, we can start to draw the chart
#using ChartDirector
#

#Create a XYChart of size 420 pixels x 240 pixels
$c = new XYChart(420, 240);

#Set the chart background to pale yellow (0xffffc0) with a 2 pixel 3D border
$c->setBackground(0xffffc0, 0xffffc0, 2);

#Set the plotarea at (70, 50) and of size 320 x 150 pixels. Set background
#color to white (0xffffff). Enable both horizontal and vertical grids by
#setting their colors to light grey (0xc0c0c0)
$c->setPlotArea(70, 50, 320, 150, 0xffffff, 0xffffff, 0xc0c0c0, 0xc0c0c0);

#Add a title to the chart
$title = $c->addTitle("Revenue for " . $SelectedYear, "timesbi.ttf");
$title->setBackground(0xffff00);

#Add a legend box at the top of the plotarea
$legend = $c->addLegend(70, 30, 0, "", 8);
$legend->setBackground(Transparent);

#Add a stacked bar chart layer using the supplied data
$layer = $c->addBarLayer2(Stack);
$layer->addDataSet($software, -1, "Software");
$layer->addDataSet($hardware, -1, "Hardware");
$layer->addDataSet($services, -1, "Services");
$layer->setBorderColor(Transparent, 1);

#Set the x axis labels. In this example, the labels must be Jan - Dec.
$labels = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sept", "Oct", "Nov", "Dec");
$c->xAxis->setLabels($labels);

#Set the x-axis width to 2 pixels
$c->xAxis->setWidth(2);

#Set the y axis title
$c->yAxis->setTitle("USD (K)");

#Set the y-axis width to 2 pixels
$c->yAxis->setWidth(2);

#Output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>




Date : 12 ธ.ค. 2547 07:53:07 By : gundam
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ผมอยากให้ file form and file action มันอยู่หน้าเดียวกัน
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่