• 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

How can I make good efficent AJAX live forms with just jQuery and

PDOException SQLSTATE[HY000] [2002] No such file or directory

How to show selected value using javascript in laravel

Hi, I am making a contact form thingy, and my php isn't working any reason why?

How to test laravel controller method?

PHP: set a (deep) array key from an array [closed]

PHP - CURL using HTTPS [closed]

How to add a sidebar to Woocommerce Shop Page?

Merge key and value of array index [duplicate]

Session timeout in Yii2

How to change HTML structure inside WP <head>

PHP header location absolute URL

Only on Firefox "Loading failed for the <script> with source"

Reload parent page after submit in iframe

Split a string array into pieces

About Contact Privacy policy Terms and conditions