Home Show values in lable based on combox which linked to DB
Reply: 0

Show values in lable based on combox which linked to DB

user2206 Published in May 21, 2018, 9:17 am

here is my try to pass the valuse into label based on combox. suppose I choose A from combox the labe must change to 1 if i select B, the lable change to the 2.

here is my try:


$sel = mysql_select_db('test',$conn);
$query=mysql_query('select * from alamat where jalan="'.$alamat.'"');
while ($data=mysql_fetch_array($query)){
echo '<label value= "' .$data[2].'"> <b> ' .$data[2].' </b> </label>;



<!DOCTYPE html>
   <title>Test Calculator</title>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="css.css">
   <link type="text/css" rel="stylesheet" href="style.css"/>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Oswald">
   <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open Sans">
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
   <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
   <script src="//code.jquery.com/jquery-1.10.2.js"></script>
   <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 
   <script src="jquery.min.js"></script>
      <label> Jalan: </label>
      <select name="alamat" id="alamat" onchange=kota(this.value)";>
         <option value=""> --Items -- </option>
         <?php $j1=mysql_query($con,'select * from alamat order by id ASC');
            while ($jalan=mysqli_fetch_row ($j1)){
            echo '<option value="'.$jalan[1].'</option>';
      <label> </br></br> kota:</label> <label name="kota" id="kota"> <b> label</b><label>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.401347 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO