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 > การเปลี่ยนสี่ของแต่ละช่อง ตามสถานะของการเลือก รบกวนหน่อยครับ



 

การเปลี่ยนสี่ของแต่ละช่อง ตามสถานะของการเลือก รบกวนหน่อยครับ

 



Topic : 070437



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



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




ตัวอย่างของ CODE ถ้าหากต้องการให้ช่องของ บรรทัดที่ //1 เปลี่ยนสี่ต้องทำยังไงครับ

Code (PHP)
 <tr>
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>  //1
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>   //2
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>  //3
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>   //4
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
      <td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
    </tr>




code ที่เขียนไว้ คือไม่ทราบว่าจะนำค่าที่ส่งกลับมาไปใช้ใน CODE ข้างบนได้ยังไงครับ เพื่อเปลี่ยนสี่แต่ละช่อง
function getcolor(){
			  include "../../connect.php";
			  include "../../chksession.php";
			  $sql="select id from register where username='$sess_username'";
			  $result=mysql_db_query($dbname,$sql);
			  $r=mysql_fetch_array($result);
			  $id=$r[id];
			  
              $sql="select * from booking where Discount='' and id_user='$id'";
			  $result1=mysql_db_query($dbname,$sql);
			  $r1=mysql_fetch_array($result1);
			  $id_tour=$r1[id_tour];
			  
			  
			  $sql="select * from chair where id_program='$id_tour'";
			  $result2=mysql_db_query($dbname,$sql);
			  $r2=mysql_fetch_array($result2);
			  $chair=$r2[chair];
			  
			  if($chair !=''){
			   $bg1='#0000ff';
			   return $bg1;
			  }
			  else
			  {
			   $bg1='#0000ff';
			   return $bg1;
			  }
			 
			   }




Tag : PHP, MySQL









ประวัติการแก้ไข
2011-12-16 02:03:06
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-12-16 02:02:45 By : ABDulwahed View : 992 Reply : 2
 

 

No. 1

Guest


Code (PHP)
<?
getcolor();    // เรียกใช้ฟังชั่น
?>

<tr>
<td width="40" height="32" bgcolor="<?=$bg1;?>"><img src="../../images/1.jpg" width="40" /></td> //1
<td width="40" height="32" bgcolor="<?=$bg2;?>"><img src="../../images/1.jpg" width="40" /></td> //2
<td width="40" height="32" bgcolor="<?=$bg3;?>"><img src="../../images/1.jpg" width="40" /></td> //3
<td width="40" height="32" bgcolor="<?=$bg4;?>"><img src="../../images/1.jpg" width="40" /></td> //4
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
</tr>








แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-12-16 03:53:19 By : yo
 


 

No. 2



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



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


แล้วตัวแปร $bg2,$bg3... มาจากไหนหรอครับ เพราะผม RETURN เฉพาะ $bg1 อย่างเดียวครับ และลองทำทั้งสอบแบบแล้วครับ ยังไม่ออกเลยครับ
แบบที่1

Code (PHP)
<tr>
<td width="40" height="32" bgcolor="<?=$bg1;?>"><img src="../../images/1.jpg" width="40" /></td> //1
<td width="40" height="32" bgcolor="<?=$bg2;?>"><img src="../../images/1.jpg" width="40" /></td> //2
<td width="40" height="32" bgcolor="<?=$bg3;?>"><img src="../../images/1.jpg" width="40" /></td> //3
<td width="40" height="32" bgcolor="<?=$bg4;?>"><img src="../../images/1.jpg" width="40" /></td> //4
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
</tr>


แบบที่2

Code (PHP)
<tr>
<td width="40" height="32" bgcolor="<?=$bg1;?>"><img src="../../images/1.jpg" width="40" /></td> //1
<td width="40" height="32" bgcolor="<?=$bg1;?>"><img src="../../images/1.jpg" width="40" /></td> //2
<td width="40" height="32" bgcolor="<?=$bg1;?>"><img src="../../images/1.jpg" width="40" /></td> //3
<td width="40" height="32" bgcolor="<?=$bg1;?>"><img src="../../images/1.jpg" width="40" /></td> //4
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
<td width="40" height="32" bgcolor=""><img src="../../images/1.jpg" width="40" /></td>
</tr>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-12-16 15:47:27 By : ABDulwahed
 

   

ค้นหาข้อมูล


   
 

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