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=pvalue textbox=u_phone textbox=total_phone ออก แล้วเพิ่ม textox ชื่อ total _room



 

ต้องการเอา textbox=pvalue textbox=u_phone textbox=total_phone ออก แล้วเพิ่ม textox ชื่อ total _room

 



Topic : 033490

Guest




ต้องการเอา textbox=pvalue textbox=u_phone textbox=total_phone ออก แล้วเพิ่ม textox ชื่อ total _room ซึ่งรับค่าจากฐานขข้อมูล $value_room แล้วเอาผลรวมทั้งหมดแสดงใน be_total คือลองทำดูแล้วแต่มันทำไม่ได้นะค่ะ ช่วยหน่อยนะค่ะ

<script type="text/javascript">
	    function addCommas(nStr) {
        nStr += '';
        x = nStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
            x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        return x1 + x2;
    }

    //*define object "Bill"
    function Bill(){
        //get form value
        var unit = {
            'water' : document.form2.wvalue.value,
            'fire' : document.form2.fvalue.value,
            'phone' : document.form2.pvalue.value
        }
        var rate = {
            'water' : document.form2.u_water.value,
            'fire' : document.form2.u_fire.value,
            'phone' : document.form2.u_phone.value
        }

        //private function
        this.calc = function(unit, rate){
            unit = parseFloat(unit);
            rate = parseFloat(rate);

            if(!unit || !rate){return 0;}
            return unit * rate;
        }

        //public properties
        this.water = this.calc(unit['water'],rate['water']);
        this.fire = this.calc(unit['fire'],rate['fire']);
        this.phone = this.calc(unit['phone'],rate['phone']);
    }

    function calcBill(){
        var bill = new Bill();

        document.form2.total_water.value = addCommas(bill.water.toFixed(2));
        document.form2.total_fire.value = addCommas(bill.fire.toFixed(2));
        document.form2.total_phone.value = addCommas(bill.phone.toFixed(2));
        document.form2.be_total.value = addCommas((bill.water + bill.fire + bill.phone).toFixed(2));
    }

</script>
<style type="text/css">
<!--
.style6 {font-weight: bold; font-style: italic; font-size: 16px;}
.style6 {color: #000080}
.style13 {color: #517dbf;
   font-weight: bold;
}
.style8 {color: #FFFFFF;
   font-size: 16px;
   font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
   color: #517DBF;
   text-decoration: none;
}
a:visited {
   text-decoration: none;
   color: #517DBF;
}
a:hover {
   text-decoration: none;
   color: #FFFFFF;
}
a:active {
   text-decoration: none;
   color: #517DBF;
}
-->
</style>
</head>

<body>
<table width="90%"  border="0" cellpadding="1" bgcolor="#66CCCC" align="center">
  
  <tr valign="top">
    <td width="82%" bgcolor="#EBF0F9"><form id="form1" name="form1" method="post" action="">
        <p align="center">ª×èÍ·Õèµéͧ¡Òäé¹ËÒ
          <select name="fields">
              <option value="<?echo "$fields";?>"> </option>
              <option value="roomno">ËÁÒÂàÅ¢Ëéͧ</option>
              <option value="name">ª×èÍ - ¹ÒÁÊ¡ØÅ</option>
            </select>
          ¨Ò¡ Filed
  <input type="text" name="keyword" value="<? echo"$keyword"; ?>" />
  <input type="submit" name="Submit" value="¤é¹ËÒ" />
        </p>
        <p align="center">
          <?
if (empty($fields) or empty($fields))
{
echo"¡ÃسÒàÅ×Í¡ÃÒ¡Òäé¹ËÒ ´éǤÃѺ";
exit();
}
else
{

$host="localhost";
$username="root";
$password="";
$db="hotelmis";
$tb="reser";
mysql_connect( $host,$username,$password) or die ("µÔ´µè͡Ѻ°Ò¹¢éÍÁÙÅ Mysql äÁèä´é ");
mysql_select_db($db) or die("àÅ×Í¡°Ò¹¢éÍÁÙÅäÁèä´é"); /* ·Ó¡ÒÃàÅ×Í¡°Ò¹¢éÍÁÙÅ¡è͹ */
$sql="SELECT * FROM $tb where  $fields like '%$keyword%' limit 0,1"; 
 mysql_query("SET NAMES 'tis620'"); 
$db_query=mysql_db_query($db,$sql);
$num_rows=mysql_num_rows($db_query); /* ¹Ñº Reccord ·Õ辺 */
if(empty($num_rows)) /* µÃǨÊͺÇèÒÁÕÍÂÙèËÃ×ÍÂѧ */
{
echo"<center><br>äÁ辺¢éÍÁÙÅ ¡Òúѹ·Ö¡¢éÍÁÙŤèÒãªé¨èÒ¢ͧËéͧ <b>$keyword</b> <b> </center>";
exit();
}
else
{
?>
        </p>
        <div align="center">
          <p><? echo " áÊ´§ÃÒ¡Òäé¹ËÒ  ¨Ò¡  $keyword"; ?> <br />
              <br />
          </p>
        </div>
        <p>
          <?
$a=0;
while($a < $num_rows)
{
$result = mysql_fetch_array($db_query);
$id=$result[id];
$password=$result[password];
$date=$result[date];
$name=$result[name];
$roomno=$result[roomno];
$email=$result[email];
$tel=$result[tel];
$value_room=$result[value_room];
?>
        </p>
        <p>
          <?
$a++;
}
}
}
?>
        </p>
            </form>
      <form id="form2" name="form2" method="post" action="unitinsert.php">
        <p>&nbsp; </p>
        <table width="93%" border="0" align="center" cellpadding="1" bordercolor="#1E3C7B" bgcolor="#1E3C7B">
          <tr>
            <td bgcolor="#EBF0F9"><table width="100%" height="125" align="center">
                <tr>
                  <td bgcolor="#1e3c7b"><span class="style14">¤èÒâ·ÃÈѾ·ì </span></td>
                  <td bgcolor="#1e3c7b"><span class="style15"></span></td>
                  <td bgcolor="#1e3c7b"><span class="style15"><strong>¤èÒ¹éÓ</strong></span></td>
                  <td bgcolor="#1e3c7b"><span class="style15"></span></td>
                  <td bgcolor="#1e3c7b"><span class="style15"><strong>¤èÒä¿</strong></span></td>
                  <td bgcolor="#1e3c7b"><span class="style15"></span></td>
                </tr>
                <tr>
                  <td width="17%" bgcolor="#EBF0F9"><div align="right"><strong>¤èÒËéͧ</strong>:</div></td>
                  <td width="11%" bgcolor="#EBF0F9"><div align="left">
                      <input type='pvalue' id='pvalue' name='pvalue' value='' onkeyup='phone1()' size="10" />
                  </div></td>
                  <td width="22%" bgcolor="#EBF0F9"><div align="right"><strong>¤èÒ¹éÓ : </strong></div></td>
                  <td width="14%" bgcolor="#EBF0F9"><div align="left">
                      <input name="wvalue" type="text" id="wvalue"onkeyup='water()'  size="10" />
                  </div></td>
                  <td width="14%" bgcolor="#EBF0F9"><div align="right"><strong>¤èÒä¿:</strong></div></td>
                  <td width="22%" bgcolor="#EBF0F9"><div align="left">
                      <input type='fvalue' id='fvalue' name='fvalue' value='' onkeyup='fire()' size="10" />
                  </div></td>
                </tr>
                <tr>
                  <td bgcolor="#EBF0F9"><div align="right"><strong>: </strong></div></td>
                  <td bgcolor="#EBF0F9"><div align="left">
                      <input type='u_phone' id='u_phone' name='u_phone' value='' onKeyUp="calcBill()" size="10" />
                  </div></td>
                  <td bgcolor="#EBF0F9"><div align="right"><strong>¤èÒ¹éÓ/˹èÇ </strong>:</div></td>
                  <td bgcolor="#EBF0F9"><div align="left">
                      <input type='unit_water' id='u_water' name='u_water' value='' onKeyUp="calcBill()" size="10" />
                  </div></td>
                  <td bgcolor="#EBF0F9"><div align="right"><strong>¤èÒä¿</strong><strong>/˹èÇ :</strong></div></td>
                  <td bgcolor="#EBF0F9"><input type='u_fire' id='u_fire' name='u_fire' value='' onKeyUp="calcBill()" size="10" /></td>
                </tr>
                <tr>
                  <td bgcolor="#EBF0F9"><div align="right"><strong>ÃÇÁ </strong><strong>:</strong></div></td>
                  <td bgcolor="#EBF0F9"><div align="left">
                      <input type="text" id="total_phone" name="total_phone" value="<?php echo $value_room;?>" onKeyUp="total()" size="10"/>

                  </div></td>
                  <td bgcolor="#EBF0F9"><div align="right"><strong>ÃÇÁ : </strong></div></td>
                  <td bgcolor="#EBF0F9"><input type='total_water' id='total_water' name='total_water' value="0"  onkeyup="calcBill()"  size="10"/></td>
                  <td bgcolor="#EBF0F9"><div align="right"><strong>ÃÇÁ:</strong></div></td>
                  <td bgcolor="#EBF0F9"><div align="left">
                      <input type='total_fire' id='total_fire' name='total_fire' value="0"  onkeyup="calcBill()"  size="10"/>
                  </div></td>
                </tr>
                <tr>
                  <td bgcolor="#EBF0F9">&nbsp;</td>
                  <td bgcolor="#EBF0F9">&nbsp;</td>
                  <td bgcolor="#EBF0F9">&nbsp;</td>
                  <td bgcolor="#EBF0F9">&nbsp;</td>
                  <td bgcolor="#EBF0F9">&nbsp;</td>
                  <td bgcolor="#EBF0F9">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="6" bgcolor="#1E3C7B"><div align="center"> <span class="style14">ÃÇÁ : </span>
                          <input type='be_total' id='be_total' name='be_total'  size="10"/>
                          <span class="style14"> ºÒ·</span></div></td>
                </tr>
            </table></td>
          </tr>
        </table>
        <p align="center"></p>
        <p align="center">
          <?   ?>
        </p>
        <p align="center">&nbsp;</p>
            <p>&nbsp;</p>
      </form>




Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-10-26 06:09:39 By : aung View : 784 Reply : 2
 

 

No. 1



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

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

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


เมาโค๊ดอ่ะพี่น้อง






Date : 2009-10-28 07:35:08 By : deawx
 


 

No. 2



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



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


ยาวจังครับ เด๋วลองดูก่อนนะครับ ได้หรือ งง ยังไง จะมาบอกอีกทีครับ
Date : 2009-10-28 09:30:09 By : tingtongkub
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ต้องการเอา textbox=pvalue textbox=u_phone textbox=total_phone ออก แล้วเพิ่ม textox ชื่อ total _room
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 อัตราราคา คลิกที่นี่