Skip to content

PHP code snippet – How to retrieve data from database using select option in laravel?

<select class="form-control" name="product_id">
    <option>Select Product</option>
    @foreach ($products as $key => $value)
        <option value="{{ $key }}" {{ ( $key == $selectedID) ? 'selected' : '' }}> 
            {{ $value }} 
        </option>
    @endforeach    
</select>
See also  Python code snippet - ldap How to print entries?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.