Search the Community
Showing results for tags 'populate combobox'.
-
Hi Good day Can someone pls help me regarding with this matter. I have a page for inserting records. And I have a combobox that is fetched through the specific field in database. I also have a table of records, for each row i have an href edit which throws the values to its respective texbox and combobox. THE PROBLEM is that when i click the href edit, the value from a selected row was not displayed from the combobox but with the textboxes it is working except from the combobox which is already fetched from the database. ------> HERE IS THE CODE FOR COMBOBOX <select name="cbocourse" style="height:35px; width:280px; background-color:#923227; box-shadow:1px 1px #FFF;color:#C90;"> <?php $sql = 'SELECT * from tblcourse'; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo '<option value= "' . $row['id']. '">' . $row['course'] . '</option>'; } ?> <?php if(@$courseid ==5){ echo "<option value = '5'>Associate in Computer Technology/option>"; } ?> ------> CODE FOR TABLE OF RECORDS do{ echo '<tr>'; echo "<td><a href = 'fastormain.php?id=".$result['id']."'onclick=\" disableupdatebtn();\"> ". '<center>' . "edit" . '<center>' ."</a></td>"; echo "<td><a href = 'fastormain.php?id=".$result['id']."&action='delete' onClick=\"return confirm('Do you want to delete this record?')\">". '<center>'."delete" . '</center>'."</a></td>"; echo '<td>' . $result['id'] .'</td>'; echo '<td>' . $result['Name'] .'</td>'; echo '<td>' . $result['gender'] .'</td>'; echo '<td>' . $result['birthday'] .'</td>'; echo '<td>' . $result['address'] .'</td>'; echo '<td>' . $result['contactnumber'] .'</td>'; echo '<td>' . $result['course'] .'</td>'; echo '<td>' . $result['branch'] .'</td>'; echo '<td>' . $result['YEAR'] .'</td>'; echo '<td>' . $result['imagename'] .'</td>'; echo '</tr>'; $result= mysql_fetch_assoc($query); } while($result);{ ----------------> AND THE CODE FOR GETTING THE ID IN HREF ?php if(isset($_GET['id'])) { $id = $_GET['id']; $sql = "select * from tblcontestants where id = {$id} limit 1"; $query = @mysql_query($sql,$connection) or die("DATABASE QUERY FAILED"); $result = mysql_fetch_assoc($query); $id=$result['id']; $fname=$result['fname']; $mname=$result['mname']; $lname=$result['lname']; $age=$result['age']; $genderid=$result['genderid']; $birthday=$result['birthday']; $address=$result['address']; $contactnumber=$result['contactnumber']; $courseid=$result['courseid']; $branchid=$result['branchid']; $yearid=$result['yearid']; $imagename=$result['imagename']; }; ?> I KNOW THAT SOMEONE CAN HELP ME! SO PLEASEEEEEEE! IT WILL BE HIGHLY APPRECIATED