|
 |
|
รบกวน ช่วยดูโคดทีคับ พอดีข้อมูลมันไม่ยอมส่งไป ยังอีกเพจอะครับ |
|
 |
|
|
 |
 |
|
คือ ผมแยกเป็น 2 เพจอะครับ เพจแรกจะเป็นหน้า เลือกรายการคับ เมื่อเลือกรายการเสร็จแล้ว จะทำการส่งค่าไปแสดงยังเพจที่2 ซึ่งส่วนนี้ผมแบ่ง ออกมาเป็น 2 ตารางคับ
- ตารางแรก โชวเกี่ยวกับ รายระเอียดขอโปรเจคคับ เช่น ชื่อโปรเจค งบประมาณ องค์กรณ์ ส่วน(ส่วนนี้โชว์ได้เรียบร้อยคับ)
- ตารางที่2 จะโชว์ เป็นรายการสินค้า ราคากลาง และรายชื่อ บริษัท (ส่วนนี้ยังนำข้อมูลมาโชว์ ไม่ได้คับ)
ผมจึงลอง echo ตัวแปร ในเพจแรก ออกมาดู ปรากฏว่ามีข้อมูลที่ต้องการครบแล้วครับ แต่ติดที่ไม่ยอมส่งค่ามาเท่านั้นเองครับ รบกวนช่วยดูให้หน่อยครับ พอดีเป็นโปรเขคของที่ฝึกงานครับ ขอบคุณครับผม
หน้าเพจแรกครับ เลือกรายการโปรเจค
<?
mysql_connect("localhost","root","1111") or die(mysql_error());
mysql_select_db("newproject");
?>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<form action="show_ready.php" method="post" name="frmMain">
รายการโปรเจค
<select name="lmName1" OnChange="window.location='?item='+this.value;">
<option value=""><-- Please Select Item --></option>
<?
$strSQL = "SELECT * FROM project ORDER BY id_project ASC";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
if($_GET["item"] == $objResult["id_project"])
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$objResult["id_project"];?>" <?=$sel;?>><?=$objResult["id_project"];?></option>
<?
}
?>
</select>
<?
if($_GET["item"] != "")
{
$strSQL = "SELECT * FROM project WHERE id_project = '".$_GET["item"]."' ";
$objQuery = mysql_query($strSQL);
$objResult2 = mysql_fetch_array($objQuery);
}
?>
<input type="hidden" name="hdnLine" value="<?=$objResult2["Nproject"];?>">
<input type="hidden" name="hdnLine2" value="<?=$objResult2["year"];?>">
<input type="hidden" name="hdnLine3" value="<?=$objResult2["priceLM"];?>">
<input type="hidden" name="hdnLine4" value="<?=$objResult2["Norg"];?>">
<?
if($_GET["item"] != "")
{
$strSQL = "SELECT company.Ncompany, product.Nproduct
From present, product, company
WHERE company.id_company = present.id_company
AND product.id_product = present.id_product
and present.id_project = '".$_GET['item']."' ";
$objQuery = mysql_query($strSQL);
$objResult2 = mysql_fetch_array($objQuery);
$num_rows = mysql_num_rows($objQuery);
}
?>
<input type="hidden" name="hdnLine5" value="<?=$objResult3["Nproduct"];?>">
<input type="hidden" name="hdnLine6" value="<?=$objResult3["Ncompany"];?>">
<? echo $objResult2["Ncompany"]; /* ลองเอคโค่ข้อมูลออกมาดู ก็มีข้อมูลอยู่ครับ */ ?>
<label>
<input type="submit" name="Submit" value="เลือก" />
</label>
</form>
</body>
</html>
<?
mysql_close();
?>
เพจที่ 2 แสดงข้อมูล
<? mysql_connect("localhost","root","1111") or die (mysql_error());
mysql_select_db("newproject");
mysql_query("set names utf8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
?>
<body>
<table width="577" border="1" align="center">
<tr>
<th colspan="4" scope="row">
<? echo $_POST["hdnLine"]; ?> </th>
</tr>
<tr>
<th colspan="3" scope="row">งบประมาณรายจ่ายประจำปีงบประมาณ</th>
<td width="144">
<? if($_POST["hdnLine2"]=="1" )
{echo "พ.ศ.2555";}
else if ($_POST["hdnLine2"]=="2")
{echo "พ.ศ.2554";}
?> </tr>
<tr>
<th width="156" scope="row">วงเงิน</th>
<th width="117" scope="row">
<? echo $_POST["hdnLine3"]; ?>
</th>
<th colspan="2" scope="row">
<? echo $_POST["hdnLine4"]; ?>
</th>
</tr>
</table>
<p> </p>
<form id="form1" name="form1" method="post" action="">
<table width="783" border="1" align="center">
///////////////////////////////ในส่วนนี้ข้อมูลโชว์ เรียบร้อยแล้วครับ////////////////////////////////////////
<tr>
<th width="56" scope="row"><div align="center" class="style1"> ลำดับ</div></th>
<td width="313"><div align="center" class="style1"> รายการ</div></td>
<td colspan="3"><div align="center" class="style1"> เปรียบเทียบ 3 รายการ </div></td>
<td width="85"><div align="center" class="style1"> ราคาจัดหา</div></td>
</tr>
<tr>
<th rowspan="2" scope="row"> </th>
<td rowspan="2"><? echo $_POST["hdnLine5"]; /*ข้อมูลไม่ยอมส่งมาคับ*/ ?></td>
<td><? echo $_POST["hdnLine6"]; ?></td>
<td> </td>
<td> </td>
<td rowspan="2"> </td>
</tr>
<tr>
<td width="100"> </td>
<td width="100"> </td>
<td width="100"> </td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
<?
mysql_close();
?>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-05-17 10:49:31 |
By :
GUNdum |
View :
903 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<input type="hidden" name="hdnLine5" value="<?=$objResult3["Nproduct"];?>">
<input type="hidden" name="hdnLine6" value="<?=$objResult3["Ncompany"];?>">
<? echo $objResult2["Ncompany"]; /* ลองเอคโค่ข้อมูลออกมาดู ก็มีข้อมูลอยู่ครับ */ ?>
อันนี้่ลอง ของ <?=$objResult3["Nproduct"];?> ว่าออกหรือเปล่านะครับไฟล์แรกน่ะ
|
 |
 |
 |
 |
Date :
2012-05-17 12:10:49 |
By :
deawx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
objResult3 มาจากไหนครับ เห็นแต่ objResult2
|
 |
 |
 |
 |
Date :
2012-05-17 12:13:55 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่าา ได้แล้วครับ ขอบคณ พี่ๆ ทั้ง 2 ท่านคับ ผิดตรง objResult3 จิงๆ ด้วย
|
 |
 |
 |
 |
Date :
2012-05-17 12:41:10 |
By :
GUNdum |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รบกวนขอถามอีกหน่อย คับ คือตอนนี้ข้อมูล ฃแสดงแล้วอะครับ แต่แสดงเพียง แถวเดียว ถ้าผมต้องการให้ข้อมูล ออกมาทั้งหมดละคับ โดยข้อมูลทั้งหมด ขึ้นอยู่กับ id_project ที่เลือกอะคับ รบกวนอีกนิด
|
 |
 |
 |
 |
Date :
2012-05-17 15:10:16 |
By :
GUNdum |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|