
ララベルで住所録を作っています。
編集フォームで、編集前のデータを表示したいと思っています。
編集自体はできるのですが、すべて空欄での再入力になってしまいます。
上記の画像のようになっています。
ララベル9
mysqlを使ってます。
cloud9を使って開発しています。
php
1編集画面 2 3<div class="container small"> 4 <h1>編集</h1> 5 <form action="{{ route('yubins.update',['id'=>$yubins->id])}}" method="POST"> 6 @csrf 7 <fieldset> 8 <div class="form-group"> 9 10 <label for="name">{{ __('名前') }}<span class="badge badge-danger ml-2">{{ __('必須') }}</span></label> 11 <input type="text" class="form-control" name="name" id="name"> 12 13 <label for="name">{{ __('郵便番号') }}<span class="badge badge-danger ml-2">{{ __('必須') }}</span></label> 14 <input type="text" class="form-control" name="post7" id="post7"> 15 16 <label for="name">{{ __('住所') }}<span class="badge badge-danger ml-2">{{ __('必須') }}</span></label> 17 <input type="text" class="form-control" name="address" id="address"> 18 19 <label for="name">{{ __('自宅電話') }}<span class="badge badge-danger ml-2">{{ __('必須') }}</span></label> 20 <input type="text" class="form-control" name="tell" id="tell"> 21 22 <label for="name">{{ __('携帯電話') }}<span class="badge badge-danger ml-2">{{ __('必須') }}</span></label> 23 <input type="text" class="form-control" name="phone" id="phone"> 24 25 <label for="name">{{ __('メールアドレス') }}<span class="badge badge-danger ml-2">{{ __('必須') }}</span></label> 26 <input type="text" class="form-control" name="email" id="email"> 27 28 </div> 29 30 <div class="d-flex justify-content-between pt-3"> 31 <a href="{{ asset('/yubins') }}" class="btn btn-outline-secondary" role="button"> 32 <i class="fa fa-reply mr-1" aria-hidden="true"></i>{{ __('一覧画面へ') }} 33 </a> 34 35 <button type="submit" class="btn btn-success"> 36 {{ __('更新') }} 37 </button> 38 </div> 39 40 </fieldset> 41 </form> 42</div>
php
1転移前ページ 2 3 <table class="table table-striped task-table"> 4 <thead> 5 <th>名前</th> <th>郵便番号</th> <th>住所</th> <th>電話番号</th> <th>携帯電話</th> <th>メール</th> 6 </thead> 7 <tbody> 8 @foreach ($yubins as $row) 9 <tr> 10 <td>{{ $row->name }}</td> 11 <td>{{ $row->post7 }}</td> 12 <td>{{ $row->address }}</td> 13 <td>{{ $row->tell}}</td> 14 <td>{{ $row->phone }}</td> 15 <td>{{ $row->email }}</td> 16 <td><a href="{{ route('yubins.edit', ['id'=>$row->id]) }}" class="btn btn-info">編集</a></td> 17 <td> 18 19 <form action="{{ route('yubins.destroy', ['id'=>$row->id]) }}" method="POST"> 20 @csrf 21 @method('delete') 22 <button type="submit" class="btn btn-danger" onclick='return confirm("削除しますか?");'>削除</button> 23 </form> 24 25 </td> 26 </tr> 27 @endforeach 28 </tbody> 29 </table>
こちらになります。
追加情報等不足の場合は、ご連絡ください。編集します。
回答1件
あなたの回答
tips
プレビュー