• 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 to change HTML structure inside WP <head>

How to validate tin and cst using PHP?

Increase value by 1 on button click

MySQL default time format UTC or GMT?

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

PHP my timezone is no setting up in PHP.ini File in xampp

Check if a string contain multiple specific words

Laravel Multi-language routes without prefix

Laravel php artisan serve to mimic HTTPS

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

how to redirect the user back to desired URL after login page in PHP?

Querying only one row from a one to many relationship laravel

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

MISSING UPDATES FOR: MEDIA Drupal 9

About Contact Privacy policy Terms and conditions