php - Get selected text from combox to a variable -
i want select school year combobox , use search classes letter year selected. need put selected text variable. $yeardb = "select distinct `year` `class`"; $do_year = mysqli_query($connectdb, $yeardb); $num_year = mysqli_num_rows($do_year); year: <form method="post" > <select id="yearcb" name="year" onchange="document.getelementbyid('selected_text').value=this.options[this.selectedindex].text"> <?php ($i=0; $i<$num_year; $i++) { $yr = mysqli_fetch_array($do_year); echo'<option value="'.$i.'">'.$yr ['year'].'</option>'; } ?> </select> <input type="hidden" name="selected_text" id="selected_text" /> </form> <?php if(isset...