• 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

protect images from being copied

Problems getting instance of UploadedFile in Yii2

Shopify password update using Shopify API

Symfony Error: "An exception has been thrown during the rendering of a template"

Refresh specific HTML content that retrieves data from MySQL

How do I get friend list from Friends table with counts of friends of my friends

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

How to disable only_full_group_by option in Laravel

Load a .env file with PHP

Shortcode or PHP inside a shortcode in Wordpress

Which is faster php date functions or carbon?

Move a child array to parent array and change parent/child name

How do I enable error reporting in Laravel?

(Cache::lock()) -> get() -- Under what conditions does it return false?

How can I easily switch between PHP versions on Mac OSX?

About Contact Privacy policy Terms and conditions