combo list nk tarik data dari database
97 replies [Last post]
does not have a status.
User offline. Last seen 5 years 7 weeks ago. Offline
Joined: 08/16/2009
Points: 1

smbg esk....ak nk blik

aku tak tau:
xbg kod yg 100% jln pn xpe,janji ko tlg.....

coz nme ko pn aku tak tau,sbb 2 xleh jln 100%....ha3
arios!!!! Laughing out loud

does not have a status.
User offline. Last seen 5 years 10 weeks ago. Offline
Joined: 08/16/2009
Points: 0

Bagi aku..faham apa yg elika nak, tapi aku msh lg nak explore benda ni sbb msh baru bg aku. So, kalo korg ade idea.. ??? Wink

does not have a status.
amiro's picture
User offline. Last seen 46 weeks 3 days ago. Offline
Moderator
Joined: 08/16/2009
Points: 278

kalu dah nama malas... dan malas nak cari...

ni aku cari.. ada je dalam forum ni... lain kali search....

<select name="id_parlimen" class="forForms" onChange="javascript: fnSubmit();">
          <option class="forForms">--Sila Pilih--</option>
          <? $query="SELECT * FROM tbl_parlimen ORDER BY id_parlimen";
                    $result=mysql_query($query);
                        while($parlimen=mysql_fetch_array($result)){
                            echo "<option value='". $parlimen['id_parlimen'] ."' class=\"forForms\""; 
                            if($_GET[kumpulan_parlimen] == $parlimen['id_parlimen']){
                            echo     " SELECTED";
                            }
                            echo ">".$parlimen['nama_parlimen']."</option>";
                        }
            ?>
        </select> 

kalu tak dapat gak... aku tak tau dah... ke nak suap sampai penuh?

does not have a status.
User offline. Last seen 31 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

dah ilang terus mood aku nak tolong...

does not have a status.
amiro's picture
User offline. Last seen 46 weeks 3 days ago. Offline
Moderator
Joined: 08/16/2009
Points: 278

ni orang panggil... BODOH SOMBONG... DAN BERLAGAK.... dah bagi... boleh pulak kata orang tu tak tau apa2.... sebab nama aku_tak_tau... ***** punya orang!!!!

does not have a status.
User offline. Last seen 31 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

amiro... biarlah dia.

does not have a status.
User offline. Last seen 5 years 10 weeks ago. Offline
Joined: 08/16/2009
Points: 0

shiro tumpang lalu....hehe,jgn gaduh2.sori nk tumpang post jap

kepada warga php.net yang senior dan join masa JJCM. shiro akan wat open house insyaallah kalo tiada aral melintang. tarikh dan masa akan di tetapkan kembali.

shirororo amiro....hehe

keje :)
zam3858's picture
User offline. Last seen 48 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

alahai... buat la topic asing.

ini status
mdpai's picture
User offline. Last seen 37 weeks 2 days ago. Offline
Moderator
Joined: 08/16/2009
Points: 71

elika setelah aku membaca post2 ko, aku assume ko reti buat query gi database, reti buat combo box, dan ada basic php..tu je yg diperlukan utk solve problem ko nih..

aku kasi pseudo code, sbb aku assume ko tau camne nak tuka pseudo code ni jadi code php

data = select data dari db
output
while data have values
then output data
output

tu je, mcm aku ade ckp kat post sebelum sebelum ni, kalau ko tau html mcm mana nak buat satu2 benda tu, mustahil dalam php ko tak tau nak buat benda yg sama..sebab kalau ko perasan kat kod yg aku kasi tu aku pakai html jugak.

does not have a status.
User offline. Last seen 5 years 7 weeks ago. Offline
Joined: 08/16/2009
Points: 1

weldan,tq.... ak dh try ko nye coding....leh run ak tgh cube nk wat die save...coz data die x save dlm DB.... pepehal,tq...... Laughing out loud 0-0

keje :)
zam3858's picture
User offline. Last seen 48 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

* tepuk dahi *

does not have a status.
User offline. Last seen 31 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

arrrr did i miss something?

Diablo 3 :) kvic#1382
kaizen's picture
User offline. Last seen 2 years 22 weeks ago. Offline
Joined: 08/16/2009
Points: 193

dulu aku pun mcm elika nih... nk kuarkan data dalam select box,, tp data dr database.. baca2 forum n tgk2 coding org.. aku faham2 sendiri je...

lebih mudah... andai kata la...
ko ade form yang byk berbentuk selectbox yang mana data dr database
ko buat satu file functions.php ker??

dlm tuh ko jadikan satu function siapkan query panggil data dr database.. outputkan dalam selectbox..

so dalam form tuh.. ko just include file include('functions.php');

so dalam form untuk buat select box.. just panggil function je...
contoh
echo getNegeri();

dlm forum nih.. aku ada bg source code.. cari la...

does not have a status.
amiro's picture
User offline. Last seen 46 weeks 3 days ago. Offline
Moderator
Joined: 08/16/2009
Points: 278

bagus la dah dapat jawapan.

terima kasih weldan sbb tolong cik elika yang sangat berbudi bahasa ni......

semoga cik elika dapat menjadi php programmer yang sangat di segani dan di hormati dan paling berbudi bahasa.

does not have a status.
User offline. Last seen 5 years 7 weeks ago. Offline
Joined: 08/16/2009
Points: 1

TO ENCIK AMIRO: SEMOGA AWAK DAPAT MENOLONG ORANG YANG MEMERLUKAN PERTOLONGAN DALAM FORUM NI, DAN MENJAWAB SOALAN SEPERTI ORANG YANG BERILMU.... JANGAN MENJAWAB SOALAN YANG TIADA KENE MENGENA DENGAN TOPIK YANG DITANYA....

SEMOGA CIK AMIRO MENJADI PROGRAMMER YANG BOLEH MENOLONG ORANG YANG BARU MENGENALI PHP

P/S KITA BERBUDI BAHASA PADA ORANG YANG PANDAI BERBUDI BAHASA,
DAN GUNA BAHASA YANG SEPATUTNYA PADA ORANG YANG TAK TAHU BAHASA

does not have a status.
amiro's picture
User offline. Last seen 46 weeks 3 days ago. Offline
Moderator
Joined: 08/16/2009
Points: 278

P/S KITA BERBUDI BAHASA PADA ORANG YANG PANDAI BERBUDI BAHASA, DAN ''GUNA BAHASA YANG SEPATUTNYA'' PADA ORANG YANG ''TAK TAHU BAHASA''

haha,dan org tu kita dah tau sape...so faham2 sendiri la ek.

nk belajar,wat cara blajar. kalo tak faham jawapan jangan salah kan org lain cakap tak paham soalan. sedangkan jawapan dah bagi bulat2.....cuma nampak dan tak nampak ja.....terangkan minda dan bukak ati....baca doa banyak2 ya.......

ok,mod sila lock thread. topic sattle.

does not have a status.
User offline. Last seen 5 years 7 weeks ago. Offline
Joined: 08/16/2009
Points: 1

statement anda berbau pergaduhan....

Mod Edit...

Edit by Amaida

keje :)
zam3858's picture
User offline. Last seen 48 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

salah guna kuasa tuh.

anyway, all your bases are belong to us.

Smile)

does not have a status.
amiro's picture
User offline. Last seen 46 weeks 3 days ago. Offline
Moderator
Joined: 08/16/2009
Points: 278

jangaan gelak ja abang zam3858 nye(gelak kejam)...please lock this topic. TQ ;;)

keje :)
zam3858's picture
User offline. Last seen 48 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

1) aku tak de permission nak lock. 2) aku suka perati org gado n try fikir sapa lagi bodo.

daku kecewa tak boleh nak pos apa2 lagi ...
amin007's picture
User offline. Last seen 14 weeks 3 days ago. Offline
Pro
Joined: 08/16/2009
Points: 2050

ini dah sampai 4 muka surat terlewat nak join ko orang hehehe Laughing out loud

lagi pun opis aku banyak kerja
kena pulak aku sekarang tengah buat projek
Kumpulan meningkatkan mutu kerja

rasanya soalan sudah terjawap
tak payah laa aku nak menambah apa yang patut

bab etika menjawap soalan tu
bagi aku jawap masih macam siti punya jawapan
no komen tamat.

take some time
User offline. Last seen 1 year 29 weeks ago. Offline
Joined: 08/16/2009
Points: 68

Saya pun nak tambah kuah jugak hu3.

1) Setiap orang ada cara masing2, tidak ada siapa betul dan siapa salah.
2) Paling penting kena ikut etika forum ini sebab kalau tuan punya forum tak puas hati paling teruk kena blacklist, langsung tak sempat orang yang baik hati menjawab soklan cepu emas anda.
3) Sama jugak kalau belajar hormat pada guru/pensyarah, masa kerja hormat pada bos, kalau dalam forum hormat pada orang yang kita tanya, dll. Maknanya orang bertanya perlu menghormati lebih sikit daripada orang yang ditanya. Macam tanya arah ke suatu tempat, tapi cakap kurang ajar agak2 dapat tau ke mana nak pergi. Silap2 dapat arahan yang salah. Lagi teruk dapat makan sup tangan. Penyelesaian lain: Pakailah telefon yang ada GPS, hu3.
4) Good Luck.
5) Maaf kalau ada yang terasa. No offence to anybody. Peace.

#zairo

Ahh! Comeback!
User offline. Last seen 1 year 11 weeks ago. Offline
Joined: 07/23/2004
Points: 0

aku pun nak tambah jugak la... ermmmm.... tak yah la.. tak jadik la plak kehkehkeh! Laughing out loud

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

aku pun nak tambah jugak

kalau dalam cakephp, tarik database masuk dalam combo list tersangat lah mudah Smile

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

Salam nak minta suggestion ckit le..I kena wat dua combo box..satu combo box adalah utk negeri satu lagi utk daerah.Contohnye bila i choose KL dari combo box pertama, yang combo box kedua plak automatic dia akan baca smua daerah bawah KL.begitu le seterusnya..Apa keypoint die erk utk search kat google..

keje :)
zam3858's picture
User offline. Last seen 48 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

try chain combobox

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

sangcunlee, aku ada satu cadangan brani mati punya >Smile >Smile

Apa kata ko study salah satu daripada berikut :

  • cakephp
  • jquery
  • prototype

Diablo 3 :) kvic#1382
kaizen's picture
User offline. Last seen 2 years 22 weeks ago. Offline
Joined: 08/16/2009
Points: 193

ko search je la combo box, select box dynamic, drop down dynamic

kat forum nih ada.. aku pun ada buat... yang nih mmg pakai ajax...

rasanya tk perlu nk adjust2 sgt code.. klu jumpa kt google.. leh dunlud and run...

cuma kepandaian anda la... mcm mana nk tukarkan code contoh ke pada data di panggil dr database.

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

urm ok..akan cuba cari..kat google.yang chain combobox tu tak byak cth sgt.nak cuba yang len..tq smua..

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

urm dah berjaya wat dua list menu.Tapi kan nak tny lagi le Smile) camne erk nak kuarkan statement kat bawah list menu tu..Contohnye bile dah select first negeri then select daerah plak..bile time select daerah tu, akan kuar beberapa baris ayat di bawah select daerah tu.contoh ayat tu seperti "Daerah Kuala Langat adalah satu tempat yang terkenal......". Camne nak kuarkan statement tu..perlu pake

ker.atau pake text box..n etc.

kalo nak kena pake

ada sape2 leh tnjukkan pada saya.

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

nak pakai div pun boleh, span pun boleh, textbox pun boleh.. nak pakai tag b pun boleh

yg penting, apa jua tag yg dipakai, pastikan ada nama idnya (dan nama tersebut adalah unik dalam satu page)

nama id tersebut digunakan dalam ajax utk update data.

Cthnya kalau pilih kuala langat.. ajax akan baca database pasal kuala langat dan paparkan di tag yang ditetapkan

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

Cara u ckp macam kena ada dlm dbase.Kalo tak wat dlm dbase takleh ke? camne erk nak letakkan div..i tak sure camne nak kuarkan

.camne nak detect
tu.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gloria Jean's Coffees</title>
<link rel="stylesheet" href="css/menu.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<link rel="stylesheet" type="text/css" href="css/product.css" />
<link rel="stylesheet" type="text/css" href="css/left_menu.css" />

<script language="javascript">
function setOptions(o)
{
var select2 = document.form1.select2;
select2.options.length = 0;
if (o == "1")
{
select2.options[select2.options.length] = new Option('Cappuccino');
select2.options[select2.options.length] = new Option('Caffee Latte');
select2.options[select2.options.length] = new Option('Flat White');
select2.options[select2.options.length] = new Option('Long Black');
select2.options[select2.options.length] = new Option('Short Black');
select2.options[select2.options.length] = new Option('Ristresso Black');
select2.options[select2.options.length] = new Option('Macchiato');
select2.options[select2.options.length] = new Option('Piccolo Latte');
}
if (o == "2")
{
select2.options[select2.options.length] = new Option('Caffe Mocha');
select2.options[select2.options.length] = new Option('Caramelatte');
select2.options[select2.options.length] = new Option('White Chocolate Mocha');
select2.options[select2.options.length] = new Option('Irish Nut Creme');
select2.options[select2.options.length] = new Option('Very Vanilla Latte');
select2.options[select2.options.length] = new Option('Minicono'); 
select2.options[select2.options.length] = new Option('Babycino');
}
if (o == "3")
{
select2.options[select2.options.length] = new Option('Tea');
select2.options[select2.options.length] = new Option('Chai Tea Latter');
}
if (o == "4")
{
select2.options[select2.options.length] = new Option('Classic Hot Chocolate');
select2.options[select2.options.length] = new Option('White Hot Chocolate');
}
}
</script>
</head>

<body>
<div id="container">
<div id="header"></div>
<div id="colddrinks_banner">
<div align="center">
</div>
</div>
<?php include("top_menu.php"); ?>
<div style="clear:both; height: 10px;"></div>
<div id="content">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="180">&nbsp;</td>
<td width="20">&nbsp;</td>
<td width="600">&nbsp;</td>
</tr>
<tr>
<td valign="top">
<table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div class="arrowgreen">
<ul>
<li><a href="#" title="Hot drink" class="selected">Hot Drinks</a></li>
</ul>
</div> </td>
</tr>
<tr>
<td>
<div class="arrowgreen">
<ul>
<li><a href="cold_drinks.php"  title="Cold Drink" >Cold Drinks</a></li>
</ul>
</div> </td>
</tr>
<tr>
<td>
<div class="arrowgreen">
<ul>
<li><a href="#" title="Merchandise">Merchandise</a></li>
</ul>
</div> </td>
</tr>
</table> </td>
<td>&nbsp;</td>
    <td>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="media/product/hot_drinks.gif" /></td>
</tr>
<tr>
<td><img src="mm_spacer.gif"  height="5"/></td>
</tr>
<tr>
<td><img src="media/about_us/aboutus_line.gif" width="600" height="2" /></td>
</tr>
<tr>
<td><img src="mm_spacer.gif"  height="5"/></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="bg-product">
<table width="600"  height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150" align="right">Choose type of hot drinks : </td>
<td width="20">&nbsp;</td>
<td width="320">
<form name="form1">
  <select name="select1" size="1"
onchange="setOptions(document.form1.select1.options[document.form1.select1.selectedIndex].value);" style="width:150px">
    <option value="1">Classic</option>
    <option value="2">Specialities</option>
    <option value="3">Tea</option>
    <option value="4">Hot Chocolate</option>
  </select>
  <select name="select2" size="1" style="width:150px;">
    <option> Caffe Mocha</option>
    <option>Caramelatte</option>
    <option>White Chocolate Mocha</option>
    <option>Irish Nut Creme</option>
    <option>Very Vanilla Latte</option>
    <option>Minicono</option>
    <option>Babycino</option>
    </select>
</form> </td>
<td width="110">&nbsp;</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
</table> </td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="dot">&nbsp;</td>
</tr>
</table> </td>   
</tr>
<tr>
<td>&nbsp;</td>
   <td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
   <td>&nbsp;</td>
<td>&nbsp;</td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
</tr>
</table>
</div>
<br clear="all" />
<div style="clear:both; height: 10px;"></div>
</div>
<div id="footer">© 2009 Gloria Jean's Coffees. All rights reserved.</div>
</body>
</html>
does not have a status.
User offline. Last seen 31 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

[] <---- bukan

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

aku_tak_tahu..aku tak perasan le aku g letak bukan [code].Ko ni takleh ada sape salah skit dlm forum ni..terus nak smash..pele..kalo leh edit nak gak aku edit..balik..tapi aku cari utk edit tak jmp2

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

sangcunlee menulis : Cara u ckp macam kena ada dlm dbase.Kalo tak wat dlm dbase takleh ke?

yup.. kena ada dalam database. Database utk menyimpan data seperti maklumat mengenai kuala langat

kalau tak nak guna database boleh gak.. guna js semata2...

tapi data kuala langat ko nak letak kat mana ?

does not have a status.
User offline. Last seen 31 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

laa aku bgtau je. ada ke aku mengeluarkan statement2 yg mengguris dah hati dan perasaan ko?

Diablo 3 :) kvic#1382
kaizen's picture
User offline. Last seen 2 years 22 weeks ago. Offline
Joined: 08/16/2009
Points: 193

ko leh dunlud yang nih.. yang nih fully php... jika rasa nak panggil data dari database.. just edit je kat function yang aku buat..

pastu ko nak buat description lepas jumpa select box kedua... boleh je..
manipulate la skit lg...

dunlud

nak extract.. ko kene rename kan balik tambah .rar

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

aku_tak_tahu, kesian niat murni ko telah disalahtafsirkan

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

sowile guys..urm camne nak wat div ni tak tahu ni

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

Macam mana nak buat div ? senang je

<div></div>

Tapi utk kes ko kena buat mcm ni la

<div id='maklumatdaerah'>data mengenai maklumat daerah akan dikemaskinikan di sini</div>

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

haha..mean nak letak div lepas combo box dah diselect.

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

yup...

letakkan pasangan tag div tersebut di tempat yg nak dipaparkan maklumat yg dikehendaki.

Kalau nak papar lepas combo list, letak selepas conbo list.

does not have a status.
User offline. Last seen 31 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

kalau nak pull dari database. kene guna ajax. konsep sama mcm dua pull down tuh. onchange call function ajax.

kalau ko tak nak pakai ajax. which is aku tak sarankan.
ko kena buat div banyak-banyak. setiap satu mempunyai id yang berlainan
lepas tuh onchange ko hantar id div yg nak dishow kepada function javascript.

aku dah tak jumpa code yang aku buat ajax or show hide
aku malas nak google.

ko boleh cuba google show hide div using javascript

or ajax show hide div

good luck!

Internet Marketeer
thephenom's picture
User offline. Last seen 37 weeks 6 days ago. Offline
Joined: 08/16/2009
Points: 123

kalau tak nak buat div byk2, boleh jugak buat array byk2 (dan aku tak sarankan jugak)

dan hantar array yg bersesuaian dengan nilai drop down ke DIV

does not have a status.
User offline. Last seen 39 weeks 5 days ago. Offline
Joined: 08/16/2009
Points: 344

Assalaamualaikum

example ...jquery base..

http://codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/
atau klik sini

does not have a status.
User offline. Last seen 46 weeks 1 day ago. Offline
Joined: 08/16/2009
Points: 2

Salam..nak minta idea ckitle..ni kode utk aku wat selection hot drink.Aku ada 2 list box.Satu utk dia pilih type of hot drinks and satu lagi flavour die. Mula2 user akan klik utk plih "type of drinks" yang dia suke, then dia akan plih "flavour" yang dia suke pl.Kemudian akan kuar info pasal flavour tu. Camne nak wat.Kesemua info pasal flabour tu i dah letak dlm database. Contohnye kalo dia pilih type of drink : Classic, ada beberapa flavour dibawah Classic Type.Antaranya cappucino, caffe latte, flat white n etc. Smua selection ini menggunakn javascript.Sekarang ni sekiranya user klik cappucino akan kuar info pasal air tersebut dibawahnye.How to do that? can anyone show me how..TQ

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gloria Jean's Coffees</title>
<link rel="stylesheet" href="css/menu.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<link rel="stylesheet" type="text/css" href="css/product.css" />
<link rel="stylesheet" type="text/css" href="css/left_menu.css" />

<script language="javascript"> 
function setOptions(drinks) 
{ 
var select2 = document.form1.select2; 
select2.options.length = 0; 
if (drinks == "1") 
{ 
select2.options[select2.options.length] = new Option('Cappuccino'); 
select2.options[select2.options.length] = new Option('Caffe Latte'); 
select2.options[select2.options.length] = new Option('Flat White'); 
select2.options[select2.options.length] = new Option('Long Black'); 
select2.options[select2.options.length] = new Option('Short Black');
select2.options[select2.options.length] = new Option('Ristresso Black');
select2.options[select2.options.length] = new Option('Macchiato');
select2.options[select2.options.length] = new Option('Piccolo Latte'); 
} 
if (drinks == "2") 
{ 
select2.options[select2.options.length] = new Option('Caffe Mocha'); 
select2.options[select2.options.length] = new Option('Caramelatte');
select2.options[select2.options.length] = new Option('White Chocolate Mocha'); 
select2.options[select2.options.length] = new Option('Irish Nut Creme'); 
select2.options[select2.options.length] = new Option('Very Vanilla Latte'); 
select2.options[select2.options.length] = new Option('Minicono');  
select2.options[select2.options.length] = new Option('Babycino'); 
} 
if (drinks == "3") 
{ 
select2.options[select2.options.length] = new Option('Tea'); 
select2.options[select2.options.length] = new Option('Chai Tea Latter'); 
} 
if (drinks == "4") 
{ 
select2.options[select2.options.length] = new Option('Classic Hot Chocolate'); 
select2.options[select2.options.length] = new Option('White Hot Chocolate'); 
}
} 
</script> 
</head>

<body>
<div id="container">
<div id="header"></div>
<div id="colddrinks_banner">
<div align="center">
</div>
</div>
<?php
include("top_menu.php");
?>

<div style="clear:both; height: 10px;"></div> <div id="content"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="180"> </td> <td width="20"> </td> <td width="600"> </td> </tr> <tr> <td valign="top"> <table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div class="arrowgreen"> <ul> <li><a href="#" title="Hot drink" class="selected">Hot Drinks</a></li> </ul> </div> </td> </tr> <tr> <td> <div class="arrowgreen"> <ul> <li><a href="cold_drinks.php" title="Cold Drink" >Cold Drinks</a></li> </ul> </div> </td> </tr> <tr> <td> <div class="arrowgreen"> <ul> <li><a href="#" title="Merchandise">Merchandise</a></li> </ul> </div> </td> </tr> </table> </td> <td> </td> <td> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="media/product/hot_drinks.gif" /></td> </tr> <tr> <td><img src="mm_spacer.gif" height="5"/></td> </tr> <tr> <td><img src="media/about_us/aboutus_line.gif" width="600" height="2" /></td> </tr> <tr> <td><img src="mm_spacer.gif" height="5"/></td> </tr> <tr> <td> </td> </tr> <tr> <td class="bg-product"> <table width="600" height="50" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="150" align="right">Choose type of hot drinks : </td> <td width="20"> </td> <td width="320"> <form name="form1"> <select name="select1" size="1" onchange="setOptions(document.form1.select1.options[document.form1.select1.selectedIndex].value);" style="width:150px"> <option value="1">Classic</option> <option value="2">Specialities</option> <option value="3">Tea</option> <option value="4">Hot Chocolate</option> </select> <select name="select2" size="1" style="width:150px;"> <option>Cappuccino</option> <option>Caffe Latte</option> <option>Flat White</option> <option>Long Black</option> <option>Short Black</option> <option>Ristresso Black</option> <option>Macchiato</option> <option>Piccolo Latte</option> </select> </form> </td> <td width="110"> </td> </tr> <tr> <td colspan="4"> </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <tr> <td class="dot"> </td> </tr> </table> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </div> <br clear="all" /> <div style="clear:both; height: 10px;"></div> </div> <div id="footer">© 2009 Gloria Jean's Coffees. All rights reserved.</div> </body> </html>

mweldan.com
weldan's picture
User offline. Last seen 36 weeks 6 days ago. Offline
Pro
Joined: 08/16/2009
Points: 297

kat option tu bleh letak class ke id ke value ke.

html

<table width="600"  height="50" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="150" align="right">Choose type of hot drinks : </td>
                                <td width="20"> </td>
                                <td width="320">
                                    <form name="form1">
                                        <select name="select1" size="1" 
                                        onchange="setOptions(document.form1.select1.options[document.form1.select1.selectedIndex].value);" style="width:150px">
                                            <option value="1">Classic</option>
                                            <option value="2">Specialities</option>
                                            <option value="3">Tea</option>
                                            <option value="4">Hot Chocolate</option>
                                        </select>
                                        <select name="select2" size="1" style="width:150px;">
                                            <option class="cappucino">Cappuccino</option>
                                            <option class="caffelatte">Caffe Latte</option>
                                            <option class="flatwhite">Flat White</option>
                                            <option class="longblack">Long Black</option>
                                            <option class="shortblack">Short Black</option>
                                            <option class="ristressoblack">Ristresso Black</option>
                                            <option class="macchiato">Macchiato</option>
                                            <option class="piccololatte">Piccolo Latte</option>
                                        </select>                                        
                                    </form>
                                </td>
                                <tr>
                                <td width="200" align="center">
                                    <p class="cappucino_kah">cappucino telah diklik. harap maklum.</p>                                    
                                </td>
                                </tr>
                            </tr>
                            <tr>
                                <td colspan="4"> </td>
                            </tr>
                        </table>                        
                    </td>
                </tr>
                <tr>
                    <td> </td>
                </tr>
                <tr>
                    <td class="dot"> </td>
                </tr>
            </table> 

lala.js

$(document).ready(function() {
    $('.cappucino_kah').hide();
    $('.cappucino').click(function()
    {
        $('.cappucino_kah').show();
    });
});