• 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

Reload parent page after submit in iframe

Combine array with same value and add other [duplicate]

How to display MySQL table using php and edit it in a web browser

Adding custom body class to the custom archive pages

disable two buttons after clicking another button

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Sentry + Laravel: how to log an already catched Exception?

PHP array, move keys and values to new array, but mix it up

How can i hide dt if dd got empty value

PHP password_verify

OAuth2 Token PHP

file_get_contents() without "Http" to access external URL [closed]

PHP only Hit Counter?

Symfony redirect if already loggedin from login page

PHP Discord OAUTH2 code sample not working

About Contact Privacy policy Terms and conditions