• 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 get user id from session in javascript?

Reorder attribute dropdown terms in Woocommerce single variable products

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

phpunit - testing is painfully slow

Symfony redirect if already loggedin from login page

woocommerce_wp_select options array from product attribute terms

Mysqli Output to a table

How to install ZeroMQ for PHP on an Alpine Linux container?

Laravel Livewire: jQuery not working in child component loaded via @if statement

Send same name multiple checkbox values via ajax

Need to display only array value in JSON output

Docker & Laravel : configure: error: Package requirements (oniguruma) were not met

Custom post type single page not working

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

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

About Contact Privacy policy Terms and conditions