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 > พอจะมีวิธีการดึงค่าข้อมูลจาก textbox มาคำนวณไหมค่ะ ค่าที่แสดงใน textbox เปน็นค่าที่ดึงจากฐานข้อมูลมาแสดงค่ะ ช่วยหน่อยนะค่ะ T^T



 

พอจะมีวิธีการดึงค่าข้อมูลจาก textbox มาคำนวณไหมค่ะ ค่าที่แสดงใน textbox เปน็นค่าที่ดึงจากฐานข้อมูลมาแสดงค่ะ ช่วยหน่อยนะค่ะ T^T

 



Topic : 110564



โพสกระทู้ ( 84 )
บทความ ( 0 )



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




พอจะมีวิธีการดึงค่าข้อมูลจาก textbox มาคำนวณไหมค่ะ ค่าที่แสดงใน textbox เปน็นค่าที่ดึงจากฐานข้อมูลมาแสดงค่ะ ช่วยหน่อยนะค่ะ T^T



Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-08-12 16:59:21 By : paweenachom View : 896 Reply : 6
 

 

No. 1



โพสกระทู้ ( 5,146 )
บทความ ( 26 )

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

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


ค้นหาคำว่า คำนวนอัตโนมัติ ในบอร์ด ก็เจอเยอะแยะ นะครับ.






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-08-12 17:08:40 By : deawx
 


 

No. 2



โพสกระทู้ ( 84 )
บทความ ( 0 )



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


รบกวนแนะนำว่าควรใช้วิธีแบบไหนดีค่ะ
hhh

หน้าฟอร์มประมาณนี้อ่ะค่ะ ค่าตัวเลขนั้น เกิดจากการเลือก listbox แล้วแสดงค่าที่เก็บในฐานข้อมูลออก ซึ่งจะนำค่าเหล่านั้นมาคำนวณ เมื่อกดปุ่ม Submit ค่ะ (ยังไม่ได้สร้างปุ่ม submit นะค่ะ)
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-08-12 17:23:26 By : paweenachom
 

 

No. 3



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



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


แล้วจะคำนวณไปไว้ตรงไหนล่ะครับ

1 สร้าง id ให้ table ก่อนนะครับ เช่น <table id='tb'> จะได้อ้างอิง tableได้
2 สร้าง function ไว้รับค่าจากปุ่ม button ที่กำลังจะสร้าง <input type=button onclick="calculateFunction()" />
function calculateFunction()

3 ภายในฟังชั่น ก็กำหนดตัวแปร ของ table ที่ต้องการอ้างอิง var tb=document.getElementById('tb');
4 เนื่องจากขอมูลมันอยู่ใน td ซึ่งอยู่ใน tr ของ tb ก็อ้างอิงได้จาก var rows=tb.rows ซึ่งเก็บในรูปแบบ array
และ อ้าอิงกับ td ใข้คำสั่ง var cell = rows[tr_index].cells[td_index] ซึ่งเก็บในรูปแบบ array เหมือนกันครับ
tr_index ก็นับค่า rows ของตารางเอานะครับ ว่ามันอยู่แถวไหน
td_index ก็เหมือนกันกับ tr_index ก็ต้องนับค่าเอาว่ามันอยู่ คอลัมน์อะไรนะครับ

แล้วก็ใช้ ฟังก์ชั่นคณิตศาสตร์ บวกเลข เอาครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-08-12 18:03:17 By : Chaidhanan
 


 

No. 4



โพสกระทู้ ( 84 )
บทความ ( 0 )



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


คำนวณไว้ตรงปริมาณสารอาหารค่ะ พอดีไม่มีความรู้ด้านนี้เลย พี่ลองดูโค้ดให้หน่อยนะค่ะ ว่าควรแก้ตรงไหน
Code (PHP)
Code (PHP)
[php]<html>
    <head>
        <script>
            function showUser(str) {
                if (str == "") {
                    document.getElementById("txtHint").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    // code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                } else { // code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET", "getuser.php?q=" + str, true);
                xmlhttp.send();
            }
        </script>

        <script>
            function showUser2(str) {
                if (str == "") {
                    document.getElementById("txtHint2").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    // code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                } else { // code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("txtHint2").innerHTML = xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET", "getuser2.php?q2=" + str, true);
                xmlhttp.send();
            }
        </script>
 <script>
            function showUser3(str) {
                if (str == "") {
                    document.getElementById("txtHint3").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    // code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                } else { // code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("txtHint3").innerHTML = xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET", "getuser3.php?q3=" + str, true);
                xmlhttp.send();
            }
        </script>
 <script>
            function showUser4(str) {
                if (str == "") {
                    document.getElementById("txtHint4").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    // code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                } else { // code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("txtHint4").innerHTML = xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET", "getuser4.php?q4=" + str, true);
                xmlhttp.send();
            }
        </script>
 <script>
            function showUser5(str) {
                if (str == "") {
                    document.getElementById("txtHint5").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    // code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                } else { // code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("txtHint5").innerHTML = xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET", "getuser5.php?q5=" + str, true);
                xmlhttp.send();
            }
        </script>
 <script>
            function showUser6(str) {
                if (str == "") {
                    document.getElementById("txtHint6").innerHTML = "";
                    return;
                }
                if (window.XMLHttpRequest) {
                    // code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                } else { // code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("txtHint6").innerHTML = xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET", "getuser6.php?q6=" + str, true);
                xmlhttp.send();
            }
        </script>


	
    </head>
<body>
<form id="form1" name="form1" method="post" action="<?php echo htmlentities($_SERVER["PHP_SELF"]); ?>">
        <br>
        <table border='1'>
            <tr>
                <th>
                    วัตถุดิบ
                </th>
                <th>
                   ข้อมูล
                </th>
            </tr>
            <tr >
                <td>
                    <select name="users" onChange="showUser(this.value)">
                        <option value="0">เลือกวัตถุดิบ</option>
                        <?php
                        include 'connectDB.php';
                        $strSQL = "SELECT * FROM raw_material";
                        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");
		



                        while ($objResult = mysql_fetch_array($objQuery)) {
                            ?>



                            <option value="<?= $objResult["rm_id"] ?>"><?= $objResult["rm_name"] ?></option>


                            <?php
                        }
                        mysql_close($objConnect);
                        ?>
                    </select>

                </td>

                <td colspan="16">  <spin id="txtHint">
				<input type="text" name="CP1"  size="3"> 
                <input type="text" name="EN1" size="3">
                <input type="text" name="Cal1" size="3">
                <input type="text" name="P1" size="3">
                <input type="text" name="Lys1" size="3">
                <input type="text" name="MC1" size="3">
                <input type="text" name="Try1" size="3">
                <input type="text" name="Thr1" size="3">
                <input type="text" name="Iso1" size="3">
                <input type="text" name="Arg1" size="3">
                <input type="text" name="Lus1" size="3">
                <input type="text" name="PT1" size="3">
                <input type="text" name="His1" size="3">
                <input type="text" name="Val1" size="3">
                <input type="text" name="Lin1" size="3">
                <input type="text" name="GC1" size="3">
				<input type="text" name="price1" size="3">
                <input type="text" name="weight1" size="3">
                

            </spin></td>
    </tr>
<tr>
                <td>
                    <select name="users" onChange="showUser2(this.value)">
                        <option value="0">เลือกวัตถุดิบ</option>
                        <?php
                        include 'connectDB.php';
                        $strSQL = "SELECT * FROM raw_material";
                        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");




                        while ($objResult = mysql_fetch_array($objQuery)) {
                            ?>



                            <option value="<?= $objResult["rm_id"] ?>"><?= $objResult["rm_name"] ?></option>


                            <?php
                        }
                        mysql_close($objConnect);
                        ?>
                    </select>

                </td>

                <td colspan="16">  <spin id="txtHint2">
				<input type="text" name="CP2" size="3"> 
                <input type="text" name="EN2" size="3">
                <input type="text" name="Cal2" size="3">
                <input type="text" name="P2" size="3">
                <input type="text" name="Lys2" size="3">
                <input type="text" name="MC2" size="3">
                <input type="text" name="Try2" size="3">
                <input type="text" name="Thr2" size="3">
                <input type="text" name="Iso2" size="3">
                <input type="text" name="Arg2" size="3">
                <input type="text" name="Lus2" size="3">
                <input type="text" name="PT2" size="3">
                <input type="text" name="His2" size="3">
                <input type="text" name="Val2" size="3">
                <input type="text" name="Lin2" size="3">
                <input type="text" name="GC2" size="3">
				<input type="text" name="price2" size="3">
                <input type="text" name="weight2" size="3">

            </spin></td>
    </tr>
	<tr>
                <td>
                    <select name="users" onChange="showUser3(this.value)">
                        <option value="0">เลือกวัตถุดิบ</option>
                        <?php
                        include 'connectDB.php';
                        $strSQL = "SELECT * FROM raw_material";
                        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");




                        while ($objResult = mysql_fetch_array($objQuery)) {
                            ?>



                            <option value="<?= $objResult["rm_id"] ?>"><?= $objResult["rm_name"] ?></option>


                            <?php
                        }
                        mysql_close($objConnect);
                        ?>
                    </select>

                </td>

                <td colspan="16">  <spin id="txtHint3">
<input type="text" name="CP3" size="3"> 
                <input type="text" name="EN3" size="3">
                <input type="text" name="Cal3" size="3">
                <input type="text" name="P3" size="3">
                <input type="text" name="Lys3" size="3">
                <input type="text" name="MC3" size="3">
                <input type="text" name="Try3" size="3">
                <input type="text" name="Thr3" size="3">
                <input type="text" name="Iso3" size="3">
                <input type="text" name="Arg3" size="3">
                <input type="text" name="Lus3" size="3">
                <input type="text" name="PT3" size="3">
                <input type="text" name="His3" size="3">
                <input type="text" name="Val3" size="3">
                <input type="text" name="Lin3" size="3">
                <input type="text" name="GC3" size="3">
				<input type="text" name="price3" size="3">
                <input type="text" name="weight3" size="3">

            </spin></td>
    </tr>
	<tr>
                <td>
                    <select name="users" onChange="showUser4(this.value)">
                        <option value="0">เลือกวัตถุดิบ</option>
                        <?php
                        include 'connectDB.php';
                        $strSQL = "SELECT * FROM raw_material";
                        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");




                        while ($objResult = mysql_fetch_array($objQuery)) {
                            ?>



                            <option value="<?= $objResult["rm_id"] ?>"><?= $objResult["rm_name"] ?></option>


                            <?php
                        }
                        mysql_close($objConnect);
                        ?>
                    </select>

                </td>

                <td colspan="16">  <spin id="txtHint4">
				<input type="text" name="CP4" size="3"> 
                <input type="text" name="EN4" size="3">
                <input type="text" name="Cal4" size="3">
                <input type="text" name="P4" size="3">
                <input type="text" name="Lys4" size="3">
                <input type="text" name="MC4" size="3">
                <input type="text" name="Try4" size="3">
                <input type="text" name="Thr4" size="3">
                <input type="text" name="Iso4" size="3">
                <input type="text" name="Arg4" size="3">
                <input type="text" name="Lus4" size="3">
                <input type="text" name="PT4" size="3">
                <input type="text" name="His4" size="3">
                <input type="text" name="Val4" size="3">
                <input type="text" name="Lin4" size="3">
                <input type="text" name="GC4" size="3">
				<input type="text" name="price4" size="3">
                <input type="text" name="weight4" size="3">

            </spin></td>
    </tr>
	<tr>
                <td>
                    <select name="users" onChange="showUser5(this.value)">
                        <option value="0">เลือกวัตถุดิบ</option>
                        <?php
                        include 'connectDB.php';
                        $strSQL = "SELECT * FROM raw_material";
                        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");




                        while ($objResult = mysql_fetch_array($objQuery)) {
                            ?>



                            <option value="<?= $objResult["rm_id"] ?>"><?= $objResult["rm_name"] ?></option>


                            <?php
                        }
                        mysql_close($objConnect);
                        ?>
                    </select>

                </td>

                <td colspan="16">  <spin id="txtHint5">
				<input type="text" name="CP5" size="3"> 
                <input type="text" name="EN5" size="3">
                <input type="text" name="Cal5" size="3">
                <input type="text" name="P5" size="3">
                <input type="text" name="Lys5" size="3">
                <input type="text" name="MC5" size="3">
                <input type="text" name="Try5" size="3">
                <input type="text" name="Thr5" size="3">
                <input type="text" name="Iso5" size="3">
                <input type="text" name="Arg5" size="3">
                <input type="text" name="Lus5" size="3">
                <input type="text" name="PT5" size="3">
                <input type="text" name="His5" size="3">
                <input type="text" name="Val5" size="3">
                <input type="text" name="Lin5" size="3">
                <input type="text" name="GC5" size="3">
				<input type="text" name="price5" size="3">
                <input type="text" name="weight5" size="3">

            </spin></td>
    </tr>
	<tr>
                <td>
                    <select name="users" onChange="showUser6(this.value)">
                        <option value="0">เลือกวัตถุดิบ</option>
                        <?php
                        include 'connectDB.php';
                        $strSQL = "SELECT * FROM raw_material";
                        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");




                        while ($objResult = mysql_fetch_array($objQuery)) {
                            ?>



                            <option value="<?= $objResult["rm_id"] ?>"><?= $objResult["rm_name"] ?></option>


                            <?php
                        }
                        mysql_close($objConnect);
                        ?>
                    </select>

                </td>

                <td colspan="16">  <spin id="txtHint6">
				<input type="text" name="CP6" size="3"> 
                <input type="text" name="EN6" size="3">
                <input type="text" name="Cal6" size="3">
                <input type="text" name="P6" size="3">
                <input type="text" name="Lys6" size="3">
                <input type="text" name="MC6" size="3">
                <input type="text" name="Try6" size="3">
                <input type="text" name="Thr6" size="3">
                <input type="text" name="Iso6" size="3">
                <input type="text" name="Arg6" size="3">
                <input type="text" name="Lus6" size="3">
                <input type="text" name="PT6" size="3">
                <input type="text" name="His6" size="3">
                <input type="text" name="Val6" size="3">
                <input type="text" name="Lin6" size="3">
                <input type="text" name="GC6" size="3">
				<input type="text" name="price6" size="3">
                <input type="text" name="weight6" size="3">

            </spin></td>
    </tr>
	<tr>
	 <th>ปริมาณสารอาหาร</th>
      <td align="center">
	  <?php
	  	$CP1 = $_POST["CP1"];
		$CP2 = $_POST["CP2"];
		$CP3 = $_POST["CP3"];
		$CP4 = $_POST["CP4"];
		$CP5 = $_POST["CP5"];
		$CP6 = $_POST["CP6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_CP1 = ($CP1 * $weight1)/100;
		$T_CP2 = ($CP2 * $weight2)/100;
		$T_CP3 = ($CP3 * $weight3)/100;
		$T_CP4 = ($CP4 * $weight4)/100;
		$T_CP5 = ($CP5 * $weight5)/100;
		$T_CP6 = ($CP6 * $weight6)/100;
		

		$Total_CP = $T_CP1+$T_CP2+$T_CP3+$T_CP4+$T_CP5+$T_CP6;
		echo number_format($Total_CP, 2, ".", "");
	  	?></td>
      <td align="center">
	  <?php
	  	$EN1 = $_POST["EN1"];
		$EN2 = $_POST["EN2"];
		$EN3 = $_POST["EN3"];
		$EN4 = $_POST["EN4"];
		$EN5 = $_POST["EN5"];
		$EN6 = $_POST["EN6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_EN1 = ($EN1 * $weight1)/100;
		$T_EN2 = ($EN2 * $weight2)/100;
		$T_EN3 = ($EN3 * $weight3)/100;
		$T_EN4 = ($EN4 * $weight4)/100;
		$T_EN5 = ($EN5 * $weight5)/100;
		$T_EN6 = ($EN6 * $weight6)/100;
		
		
		$Total_EN = $T_EN1+$T_EN2+$T_EN3+$T_EN4+$T_EN5+$T_EN6;
		echo number_format($Total_EN, 2, ".", "");	
      ?></td>
      <td align="center">
	  <?php
	 	$Cal1 = $_POST["Cal1"];
		$Cal2 = $_POST["Cal2"];
		$Cal3 = $_POST["Cal3"];
		$Cal4 = $_POST["Cal4"];
		$Cal5 = $_POST["Cal5"];
		$Cal6 = $_POST["Cal6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Cal1 = ($Cal1 * $weight1)/100;
		$T_Cal2 = ($Cal2 * $weight2)/100;
		$T_Cal3 = ($Cal3 * $weight3)/100;
		$T_Cal4 = ($Cal4 * $weight4)/100;
		$T_Cal5 = ($Cal5 * $weight5)/100;
		$T_Cal6 = ($Cal6 * $weight6)/100;
		
		
		$Total_Cal = $T_Cal1+$T_Cal2+$T_Cal3+$T_Cal4+$T_Cal5+$T_Cal6;
		echo number_format($Total_Cal, 2, ".", "");
      ?></td>
      <td align="center">
	  <?php
	  	$P1 = $_POST["P1"];
		$P2 = $_POST["P2"];
		$P3 = $_POST["P3"];
		$P4 = $_POST["P4"];
		$P5 = $_POST["P5"];
		$P6 = $_POST["P6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_P1 = ($P1 * $weight1)/100;
		$T_P2 = ($P2 * $weight2)/100;
		$T_P3 = ($P3 * $weight3)/100;
		$T_P4 = ($P4 * $weight4)/100;
		$T_P5 = ($P5 * $weight5)/100;
		$T_P6 = ($P6 * $weight6)/100;
		
		
		$Total_P = $T_P1+$T_P2+$T_P3+$T_P4+$T_P5+$T_P6;
		echo number_format($Total_P, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Lys1 = $_POST["Lys1"];
		$Lys2 = $_POST["Lys2"];
		$Lys3 = $_POST["Lys3"];
		$Lys4 = $_POST["Lys4"];
		$Lys5 = $_POST["Lys5"];
		$Lys6 = $_POST["Lys6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Lys1 = ($Lys1 * $weight1)/100;
		$T_Lys2 = ($Lys2 * $weight2)/100;
		$T_Lys3 = ($Lys3 * $weight3)/100;
		$T_Lys4 = ($Lys4 * $weight4)/100;
		$T_Lys5 = ($Lys5 * $weight5)/100;
		$T_Lys6 = ($Lys6 * $weight6)/100;
		
		
		$Total_Lys = $T_Lys1+$T_Lys2+$T_Lys3+$T_Lys4+$T_Lys5+$T_Lys6;
		echo number_format($Total_Lys, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$MC1 = $_POST["MC1"];
		$MC2 = $_POST["MC2"];
		$MC3 = $_POST["MC3"];
		$MC4 = $_POST["MC4"];
		$MC5 = $_POST["MC5"];
		$MC6 = $_POST["MC6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_MC1 = ($MC1 * $weight1)/100;
		$T_MC2 = ($MC2 * $weight2)/100;
		$T_MC3 = ($MC3 * $weight3)/100;
		$T_MC4 = ($MC4 * $weight4)/100;
		$T_MC5 = ($MC5 * $weight5)/100;
		$T_MC6 = ($MC6 * $weight6)/100;
		
		
		$Total_MC = $T_MC1+$T_MC2+$T_MC3+$T_MC4+$T_MC5+$T_MC6;
		echo number_format($Total_MC, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Try1 = $_POST["Try1"];
		$Try2 = $_POST["Try2"];
		$Try3 = $_POST["Try3"];
		$Try4 = $_POST["Try4"];
		$Try5 = $_POST["Try5"];
		$Try6 = $_POST["Try6"];
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		$T_Try1 = ($Try1 * $weight1)/100;
		$T_Try2 = ($Try2 * $weight2)/100;
		$T_Try3 = ($Try3 * $weight3)/100;
		$T_Try4 = ($Try4 * $weight4)/100;
		$T_Try5 = ($Try5 * $weight5)/100;
		$T_Try6 = ($Try6 * $weight6)/100;
	
		
		$Total_Try = $T_Try1+$T_Try2+$T_Try3+$T_Try4+$T_Try5+$T_Try6;
		echo number_format($Total_Try, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Thr1 = $_POST["Thr1"];
		$Thr2 = $_POST["Thr2"];
		$Thr3 = $_POST["Thr3"];
		$Thr4 = $_POST["Thr4"];
		$Thr5 = $_POST["Thr5"];
		$Thr6 = $_POST["Thr6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Thr1 = ($Thr1 * $weight1)/100;
		$T_Thr2 = ($Thr2 * $weight2)/100;
		$T_Thr3 = ($Thr3 * $weight3)/100;
		$T_Thr4 = ($Thr4 * $weight4)/100;
		$T_Thr5 = ($Thr5 * $weight5)/100;
		$T_Thr6 = ($Thr6 * $weight6)/100;
		
		
		$Total_Thr = $T_Thr1+$T_Thr2+$T_Thr3+$T_Thr4+$T_Thr5+$T_Thr6;
		echo number_format($Total_Thr, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Iso1 = $_POST["Iso1"];
		$Iso2 = $_POST["Iso2"];
		$Iso3 = $_POST["Iso3"];
		$Iso4 = $_POST["Iso4"];
		$Iso5 = $_POST["Iso5"];
		$Iso6 = $_POST["Iso6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Iso1 = ($Iso1 * $weight1)/100;
		$T_Iso2 = ($Iso2 * $weight2)/100;
		$T_Iso3 = ($Iso3 * $weight3)/100;
		$T_Iso4 = ($Iso4 * $weight4)/100;
		$T_Iso5 = ($Iso5 * $weight5)/100;
		$T_Iso6 = ($Iso6 * $weight6)/100;
		
		
		$Total_Iso = $T_Iso1+$T_Iso2+$T_Iso3+$T_Iso4+$T_Iso5+$T_Iso6;
		echo number_format($Total_Iso, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Arg1 = $_POST["Arg1"];
		$Arg2 = $_POST["Arg2"];
		$Arg3 = $_POST["Arg3"];
		$Arg4 = $_POST["Arg4"];
		$Arg5 = $_POST["Arg5"];
		$Arg6 = $_POST["Arg6"];
	
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Arg1 = ($Arg1 * $weight1)/100;
		$T_Arg2 = ($Arg2 * $weight2)/100;
		$T_Arg3 = ($Arg3 * $weight3)/100;
		$T_Arg4 = ($Arg4 * $weight4)/100;
		$T_Arg5 = ($Arg5 * $weight5)/100;
		$T_Arg6 = ($Arg6 * $weight6)/100;
		
		
		$Total_Arg = $T_Arg1+$T_Arg2+$T_Arg3+$T_Arg4+$T_Arg5+$T_Arg6;
		echo number_format($Total_Arg, 2, ".", "");
      ?></td>
      <td align="center">
	  <?php
	  	$Lus1 = $_POST["Lus1"];
		$Lus2 = $_POST["Lus2"];
		$Lus3 = $_POST["Lus3"];
		$Lus4 = $_POST["Lus4"];
		$Lus5 = $_POST["Lus5"];
		$Lus6 = $_POST["Lus6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Lus1 = ($Lus1 * $weight1)/100;
		$T_Lus2 = ($Lus2 * $weight2)/100;
		$T_Lus3 = ($Lus3 * $weight3)/100;
		$T_Lus4 = ($Lus4 * $weight4)/100;
		$T_Lus5 = ($Lus5 * $weight5)/100;
		$T_Lus6 = ($Lus6 * $weight6)/100;
		
		
		$Total_Lus = $T_Lus1+$T_Lus2+$T_Lus3+$T_Lus4+$T_Lus5+$T_Lus6;
		echo number_format($Total_Lus, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$PT1 = $_POST["PT1"];
		$PT2 = $_POST["PT2"];
		$PT3 = $_POST["PT3"];
		$PT4 = $_POST["PT4"];
		$PT5 = $_POST["PT5"];
		$PT6 = $_POST["PT6"];
		;
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_PT1 = ($PT1 * $weight1)/100;
		$T_PT2 = ($PT2 * $weight2)/100;
		$T_PT3 = ($PT3 * $weight3)/100;
		$T_PT4 = ($PT4 * $weight4)/100;
		$T_PT5 = ($PT5 * $weight5)/100;
		$T_PT6 = ($PT6 * $weight6)/100;
		
		
		$Total_PT = $T_PT1+$T_PT2+$T_PT3+$T_PT4+$T_PT5+$T_PT6;
		echo number_format($Total_PT, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$His1 = $_POST["His1"];
		$His2 = $_POST["His2"];
		$His3 = $_POST["His3"];
		$His4 = $_POST["His4"];
		$His5 = $_POST["His5"];
		$His6 = $_POST["His6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_His1 = ($His1 * $weight1)/100;
		$T_His2 = ($His2 * $weight2)/100;
		$T_His3 = ($His3 * $weight3)/100;
		$T_His4 = ($His4 * $weight4)/100;
		$T_His5 = ($His5 * $weight5)/100;
		$T_His6 = ($His6 * $weight6)/100;
		
		
		$Total_His = $T_His1+$T_His2+$T_His3+$T_His4+$T_His5+$T_His6;
		echo number_format($Total_His, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Val1 = $_POST["Val1"];
		$Val2 = $_POST["Val2"];
		$Val3 = $_POST["Val3"];
		$Val4 = $_POST["Val4"];
		$Val5 = $_POST["Val5"];
		$Val6 = $_POST["Val6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Val1 = ($Val1 * $weight1)/100;
		$T_Val2 = ($Val2 * $weight2)/100;
		$T_Val3 = ($Val3 * $weight3)/100;
		$T_Val4 = ($Val4 * $weight4)/100;
		$T_Val5 = ($Val5 * $weight5)/100;
		$T_Val6 = ($Val6 * $weight6)/100;
	
		
		$Total_Val = $T_Val1+$T_Val2+$T_Val3+$T_Val4+$T_Val5+$T_Val6;
		echo number_format($Total_Val, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
	  	$Lin1 = $_POST["Lin1"];
		$Lin2 = $_POST["Lin2"];
		$Lin3 = $_POST["Lin3"];
		$Lin4 = $_POST["Lin4"];
		$Lin5 = $_POST["Lin5"];
		$Lin6 = $_POST["Lin6"];
		
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_Lin1 = ($Lin1 * $weight1)/100;
		$T_Lin2 = ($Lin2 * $weight2)/100;
		$T_Lin3 = ($Lin3 * $weight3)/100;
		$T_Lin4 = ($Lin4 * $weight4)/100;
		$T_Lin5 = ($Lin5 * $weight5)/100;
		$T_Lin6 = ($Lin6 * $weight6)/100;
		
		
		$Total_Lin = $T_Lin1+$T_Lin2+$T_Lin3+$T_Lin4+$T_Lin5+$T_Lin6;
		echo number_format($Total_Lin, 2, ".", "");
      ?></td>
      <td align="center">
	  <?php
	  	$GC1 = $_POST["GC1"];
		$GC2 = $_POST["GC2"];
		$GC3 = $_POST["GC3"];
		$GC4 = $_POST["GC4"];
		$GC5 = $_POST["GC5"];
		$GC6 = $_POST["GC6"];
	
		
		$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$T_GC1 = ($GC1 * $weight1)/100;
		$T_GC2 = ($GC2 * $weight2)/100;
		$T_GC3 = ($GC3 * $weight3)/100;
		$T_GC4 = ($GC4 * $weight4)/100;
		$T_GC5 = ($GC5 * $weight5)/100;
		$T_GC6 = ($GC6 * $weight6)/100;
		
		
		$Total_GC = $T_GC1+$T_GC2+$T_GC3+$T_GC4+$T_GC5+$T_GC6;
		echo number_format($Total_GC, 2, ".", "");
      ?></td>
      <td align="center">&nbsp;</td>
      <td align="center">
      <?php
	  	$weight1 = $_POST["weight1"];
		$weight2 = $_POST["weight2"];
		$weight3 = $_POST["weight3"];
		$weight4 = $_POST["weight4"];
		$weight5 = $_POST["weight5"];
		$weight6 = $_POST["weight6"];
		
		
		$Total_weight = $weight1+$weight2+$weight3+$weight4+$weight5+$weight6;
		echo number_format($Total_weight, 2, ".", "");
      ?></td>
      <td align="center">
      <?php
$price1 = $_POST["price1"];
$price2 = $_POST["price2"];
$price3 = $_POST["price3"];
$price4 = $_POST["price4"];
$price5 = $_POST["price5"];
$price6 = $_POST["price6"];


$weight1 = $_POST["weight1"];
$weight2 = $_POST["weight2"];
$weight3 = $_POST["weight3"];
$weight4 = $_POST["weight4"];
$weight5 = $_POST["weight5"];
$weight6 = $_POST["weight6"];


$T_price1 =$price1*$weight1;
$T_price2 =$price2*$weight2;
$T_price3 =$price3*$weight3;
$T_price4 =$price4*$weight4;
$T_price5 =$price5*$weight5;
$T_price6 =$price6*$weight6;


$Total_price = $T_price1+$T_price2+$T_price3+$T_price4+$T_price5+$T_price6;
echo number_format($Total_price, 2, ".", "");
?></td>
    </tr>
  </table>
  <p>
    <center><input type="submit" name="button" id="button" value="Submit" />
    </center>
  </p>
</form>



</body>
</html>

[/php]
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-08-12 18:54:49 By : paweenachom
 


 

No. 5



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



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


อะโห หลักพันบันทัดเลยนะครับเนี่ย ไปก๊อบใครมาทำได้ขนาดนี้

อันดับแรก ลองไป เขียน
function showUser 1-6 ให้เป็น ฟังชั่นเดียวก่อนครับ ใช้ตัวแปร ในการขวบคุณการส่ง request
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-08-12 19:01:49 By : Chaidhanan
 


 

No. 6



โพสกระทู้ ( 84 )
บทความ ( 0 )



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


ค่ะ ขอบคุณคร้าา ^_^
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-08-12 19:10:02 By : paweenachom
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : พอจะมีวิธีการดึงค่าข้อมูลจาก textbox มาคำนวณไหมค่ะ ค่าที่แสดงใน textbox เปน็นค่าที่ดึงจากฐานข้อมูลมาแสดงค่ะ ช่วยหน่อยนะค่ะ T^T
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 03
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 อัตราราคา คลิกที่นี่