• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Dropdown with current value from Mysql

phphtmlmysqldropdown


PHP Snippet 1:

<select name="vendors" id="vendors"  required>
                    
<?php
    include "dbConn.php";  
    $records = mysqli_query($db, "SELECT vendors FROM tools WHERE id=$id UNION SELECT vendoren FROM vendors");  

    while($data = mysqli_fetch_array($records))
    {
        echo "<option value='". $data['vendors'] ."'>" .$data['vendors'] ."</option>";  
    }   
?>  </select>

Related Snippets

PHPExcel How to set conditional formatting to change cell background color based on cells values

how to create html table in php

Group data in a multidimensional array based on two columns

Laravel set default language not working

Dynamic dropdown Ajax PHP request

Limit login attempts in Laravel 5.7

Reducing authentication calls on external API (Laravel 5.6)

How to disable only_full_group_by option in Laravel

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

Symfony there are no commands defined in the "make" namespace

500 Internal Server Error on Ajax request. Not sure the origin of the problem

Laravel Route issues with Route order in web.php

PHP/HTML: Creating A SubMenu

Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

About Contact Privacy policy Terms and conditions