0
我想保存在我的數據庫中的多個形式記錄,但它只是在我的刀片循環寫最後一個記錄。
//This is my loop in blade. for getting multiple informations
@for ($i = 1; $i < $package->package_for + 1; $i++)
我想保存在我的數據庫中的多個形式記錄,但它只是在我的刀片循環寫最後一個記錄。
//This is my loop in blade. for getting multiple informations
@for ($i = 1; $i < $package->package_for + 1; $i++)
@for ($i = 1; $i < $package->package_for + 1; $i++)
<div class="container information">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading"><h3>Guest {{ $i }}</h3></div>
<div class="panel-body">
<form class="form-horizontal" action="{{ route('information', ['id' => $package->id]) }}" role="form" method="POST">
<div class="col-md-9 col-md-offset-2 fullname">
<div class="gender">
<label>  </label>
<select type="text" id="gender" class="form-control col-md-1" name="gender" required>
<option value="1">Mr</option>
<option value="2">Mrs</option>
</select>
</div>
<div class="form-group{{ $errors->has('firstname') ? ' has-error' : '' }}">
<label> First Name</label>
<input id="firstname" placeholder="First Name" type="text" class="form-control" name="firstname" required>
@if ($errors->has('firstname'))
<span class="help-block">
<strong>{{ $errors->first('firstname') }}</strong>
</span>
@endif
</div>
<div class="form-group{{ $errors->has('lastname') ? ' has-error' : '' }}">
<label> First Name</label>
<input id="lastname" placeholder="Last Name" type="text" class="form-control" name="lastname" required>
@if ($errors->has('lastname'))
<span class="help-block">
<strong>{{ $errors->first('lastname') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('contact_number') ? ' has-error' : '' }}">
<label for="contact_number" class="col-md-4 control-label"> </label>
<div class="col-md-6">
<label>Contact Number</label>
<input id="contact_number_number" placeholder="Contact Number" type="contact_number" class="form-control" name="contact_number" required>
@if ($errors->has('contact_number'))
<span class="help-block">
<strong>{{ $errors->first('contact_number') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('age') ? ' has-error' : '' }}">
<label for="age" class="col-md-4 control-label"> </label>
<div class="col-md-6">
<label>Age</label>
<select type="text" id="age" class="form-control col-md-1" name="age" required>
@for ($b = 1; $b < 50; $b++)
<option value="$i">{!! $b !!}</option>
@endfor
</select>
@if ($errors->has('age'))
<span class="help-block">
<strong>{{ $errors->first('age') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}">
<label for="address" class="col-md-4 control-label"> </label>
<div class="col-md-6">
<label>Address</label>
<input id="address" placeholder="Address" type="address" class="form-control" name="address" value="{{ old('address') }}" required>
@if ($errors->has('address'))
<span class="help-block">
<strong>{{ $errors->first('address') }}</strong>
</span>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endfor
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary" href="{{ route('package.addToCart', ['id' => $package->id]) }}">
Book Package
</button>
{{ csrf_field() }}
</div>
</div>
</form>
你能展現形式呢? –
這是我的刀鋒形式。 –