Ich benutze Laravel 5.2.
Meine Frage ist:
Wie erhalten Sie eine Gruppe von Kontrollkästchen und speichern Sie es in einer Datenbank?
zum Beispiel:Laravel 5.2: Wie erhalte ich eine Checkbox und speichere sie in einer Datenbank?
{!! Form::open(array('url' => 'foo/bar')) !!}
<fieldset class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
<small class="text-muted">We'll never share your email with anyone else.</small>
</fieldset>
<fieldset class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</fieldset>
<fieldset class="form-group">
<label for="exampleSelect1">Example select</label>
<select class="form-control" id="exampleSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</fieldset>
<fieldset class="form-group">
<label for="exampleSelect2">Example multiple select</label>
<select multiple class="form-control" id="exampleSelect2">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</fieldset>
<fieldset class="form-group">
<label for="exampleTextarea">Example textarea</label>
<textarea class="form-control" id="exampleTextarea" rows="3"></textarea>
</fieldset>
<fieldset class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" class="form-control-file" id="exampleInputFile">
<small class="text-muted">This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line.</small>
</fieldset>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
Option one is this and that—be sure to include why it's great
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
Option two can be something else and selecting it will deselect option one
</label>
</div>
<div class="radio disabled">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios3" value="option3" disabled>
Option three is disabled
</label>
</div>
<div class="checkbox">
<label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="checkbox[]" value="option1"> 1
</label>
<label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox2" name="checkbox[]" value="option2"> 2
</label>
<label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox3" name="checkbox[]" value="option3"> 3
</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
{!! Form::close() !!}
Ich weiß, wie Text erhalten, E-Mail, wählen Sie, Radio, TextArea- etc und sie in eine Datenbank speichern, aber ich weiß nicht, wie eine Gruppe von Kontrollkästchen empfangen und speichern in eine Datenbank.
Ich bin nicht sicher, ob ich verstehe Ihre Frage, tun Sie das geprüfte Checkbox wollen überprüft werden, wenn die Seite geladen wird? – ExohJosh
@excojish ja, also muss ich das checked checkbox (es) in der Datenbank zuerst speichern. Und die zweite Frage ist, was Sie sagten. – sunshine
Frage nicht klar. Was sind diese Kontrollkästchen? – Abhishek