• 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

php - add comma thousands separator but remove trailing zeros

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

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Install mysql client in docker image

Add New Parameter to Existing URL using htaccess

Remove country code from phone number?

Project structure for PHP

Pagekite error: FAIL: localhost:8080 is down

SQLSTATE[HY000]: General error: 1 table posts has no column named *

How to get the ID of the link in another page in php

Form Validation and Submission to database

Display the WooCommerce product price inside a custom function

generate an Excel file using PHP

XDebug not working in VScode for php debugging

Sort a multidimensional array by integer inside of a string value which is two levels down

About Contact Privacy policy Terms and conditions