-2

I have 2 select menu :

<select name="nama_paket">
 <?php
do {  
?>
<option value="<?php echo $row_qpaket['nama_paket']?>"><?php echo $row_qpaket['nama_paket']?></option>
<?php
} while ($row_qpaket = mysql_fetch_assoc($qpaket));
 $rows = mysql_num_rows($qpaket);
if($rows > 0) {
mysql_data_seek($qpaket, 0);
$row_qpaket = mysql_fetch_assoc($qpaket);
 }
?>
</select>

and

<select name="harga">
<?php
do {
?>
<option value="<?php echo $row_qpaket['harga']?>" ><?php echo $row_qpaket['harga']?></option>
<?php
} while ($row_qpaket = mysql_fetch_assoc($qpaket));
?>
</select>

when we select the first select menu the second select menu change automatically? Thanks

Newbie11
  • 1
  • 2

3 Answers3

0

You need to get select name="hagra" via AJAX after selecting select name="nama_paket"

newbie67
  • 41
  • 2
0

If you want to change it Dynamically when according to 1st selected value, you need to use ajax in order to do this

this answer explain it

Community
  • 1
  • 1
menaka
  • 1,045
  • 1
  • 12
  • 30
0

You can use Jquery .change() event for this. Like:

$('select[name=nama_paket]').change(function(){
  // your code you can set different value to second select box
})
Community
  • 1
  • 1
Manwal
  • 23,450
  • 12
  • 63
  • 93