• 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

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

phpmysqllaravel


PHP Snippet 1:

public function create()
{
    $doas =  Doas::all();

    return view('note/create', compact('doas'));
}

PHP Snippet 2:

<div class="container">
    <label class="form-label text-white" style="font-weight: bold;" for="doa">Doa terkait</label>
    <select class="form-select" style="color: #41A7A5" aria-label="Default select example">
        @foreach ($doas as $doa)
            <option value="{{$doa-id>}}">{{$doa->name}}</option>
        @endforeach
    </select>
</div>

Related Snippets

Doctrine 2 mapping referencing unique key

php - add comma thousands separator but remove trailing zeros

How to submit a form when page loads using JavaScript?

Confirm Leave on External Links in Wordpress

Creating Combinations of Elements

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

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'column_name' in Laravel

How to properly start Laravel 8 with Bootstrap & authentication

Fatal error: [] operator not supported for strings

PHP password_verify

Insert And Retrieve Data in MySQL with $.post Noob Question

How to get AJAX to post on second page?

Add and update products to session cart in Laravel

Laravel 5.2: Unable to locate factory with name [default]

Laravel MSSQL Server Connection not working

About Contact Privacy policy Terms and conditions