2

I want to display to select the campus from the campuses table in my budget allocation create.blade.php template but it displays an error.

create.blade.php

<div class="form-group row">
          <label class="col-md-3">Campus</label>
          <div class="col-md-9">
            <select name="campus_id" class="form-control">
              <option value="">--- Select Campus ---</option>
              @foreach($campuses as $campus)
                {{ var_dump($campus) }}
                <option value="{{ $campus->campus_id }}">{{ $campus->campus_name }}</option>
              @endforeach
            </select>
          </div>
          <div class="clearfix"></div>
</div>
7
  • 2
    Can you show the text of the error which shows which variable is undefined. Commented Jul 14, 2020 at 13:34
  • Which error message you get? Commented Jul 14, 2020 at 13:35
  • Undefined variable: campuses (View: C:\xampp\htdocs\comon2\resources\views\admin\budgetallocation\create.blade.php) Commented Jul 14, 2020 at 13:36
  • Show us the controller method what return the view. Commented Jul 14, 2020 at 13:43
  • 3
    @JannVincentPaulLagmay Don't post your code in the comments... Edit your question and add it there. Commented Jul 14, 2020 at 14:04

1 Answer 1

0

in your controller you must send the data to the view using second paramter of the view ...

return view('admin.budgetallocation.create',$arr);
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much for your input :-) it's already working. I put $arr in my view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.