There should be 2 dropdownlist.
1st dropdownlist is filled with data from database "videoname" 2nd dropdownbox is filled with data from database "video_id"
when user select the 1st dropdownbox the 2nd dropdownbox will be display the corresponding data accordingly. How should i do that?
example user click lesson 1 on the 1st dropdownbox. the 2nd dropdownbox will display video_id 1
the data will be pass to another php file using form.
<?php
// save information into database
$username = "root";
$password = "";
$hostname = "localhost";
$dbname = "test_database";
//connect to the database
$dbc = mysqli_connect($hostname, $username, $password, $dbname) or die ("could not connect to the database");
//$sql = "SELECT video_id, videoname FROM viewvideo";
//echo $sql;
$result = mysqli_query($dbc, "SELECT video_id, videoname FROM viewvideo");
?>
<form action="viewvideo.php" method="post" >
<br/>
Please select the video
<br/>
<select>
<?php
while($row = mysqli_fetch_array($result)){
?>
<option value="<?php echo $row['video_id']?>">
<?php echo $row['videoname']?>
</option>
<?php
}
?>
</select>