+ 1

I need a PHP code to add a drop down list for every row I retrieve from Database. Then read the user's choice.

So, basically I have a database table with 5 fields. I need to retrieve and display those 5 fields, and additional I have a 6th column named 'action' in Front End where the user has 'confirm/reject' drop down list for every row retrieved from Database Table. After user selects the choice in DropDown list, the value is read and sent to another Database Table. Local Database.

23rd Aug 2018, 4:02 PM
Deep chand
Deep chand - avatar
2 Respuestas
+ 2
Deep chand This Code May help Retrieve data from a database column and show it as a dropdownList upvote if u find it usefull <?php if($connection = mysqli_connect("localhost","root","","dbName")) { //echo Connection is OK }else{ mysql_error("Not connected"); }; ?> <?php /**************************** START OF SEARCH ALL QUERY *******************************/ // if isset query if (isset($_POST['test'])){ echo "hello"; //query $query = mysqli_query($connection, "SELECT * FROM `databaseTable`"); ?> <input list="listSearched"> <datalist id="listSearched"> <?php //while loop while($result = mysqli_fetch_array($query)){ ?> <option value="<?php echo $colName = $result['colName']; ?>"> <?php } ?> </datalist> <?php } ?> <form action="" method="POST"> <input type="submit" value="Submit" name="test" > </form>
23rd Aug 2018, 6:49 PM
Amir Ahmad
Amir Ahmad - avatar
0
Amir Ahmad Dude, I think you got me wrong. I don't want to convert the retrieved data into DropDown list. Retrieved data should be displayed as they are, but for every row retrieved there should be another extra column of drop down list with options 'Approve/Reject'. Hope Everyone who check this understands.
24th Aug 2018, 2:41 AM
Deep chand
Deep chand - avatar