选择/选项Laravel 5.3

时间:2016-09-05 04:55:55

标签: laravel html-select laravel-5.3

我想在简单的HTML表单中使用laravel 5.3中的select和option。如何在HTML格式的laravel 5.3中使用select和option?

我的编码:

@extends('layout.navigation')
<html>
<head>
</script>
</head>
<div class="row" id="contact_form">
<div class="col-sm-4">
<form action="{{route('online_form')}}" method="post" enctype="multipart/form-data">
{!!csrf_field()!!}
<br/><br/>
<div class="panel panel-default" id="form_panel">
<div class="panel-body">
<p>fill the form </p>
<input type="text" name="username" class="form-control" placeholder="Name" required>
<br/>
<input type="text" name="email" class="form-control" placeholder="Email" required><br/>
<p style="margin-top:20px;font-size:14px">Gender :&nbsp&nbsp&nbsp&nbsp <label 
class="radio-inline"><input type="radio" style="margin-top:1px" name="gender" 
value="Male">Male</label>
<label class="radio-inline"><input type="radio" style="margin-top:1px" 
name="gender" value="female">Female<br/></label>
<p style="margin-top:20px;font-size:14px"> Select Language 
:&nbsp&nbsp&nbsp&nbsp<label class="checkbox-inline"><input type="checkbox" 
name="language" value="english">English</label>
<label class="checkbox-inline"><input type="checkbox" name="language" 
value="hindi">Hindi</label>
<br/><br/>
<select id="state">
<option value="rajasthan">Rajasthan</option>
<option value="madhya pradesh">Madhya Pradesh</option>
</select>
<input type="submit" name="submit" value="Enter" class="btn btn-primary" >
</form>
</div>
</div>

3 个答案:

答案 0 :(得分:0)

要获取控制器方法中的状态值,可以使用Input外观。

$state = Input::get('state');

答案 1 :(得分:0)

您可以在编辑器"laravelcollective/html": "~5.0"中包含以下内容作为依赖项,然后将其包含在您的config / app中

现在,您可以使用以下方式创建选择下拉列表:

echo Form::select('gender', array('Male', 'Female'));

echo Form::select('language', array('English', 'Hindi'));

等等。

有关此集体的更多信息, 检查this

答案 2 :(得分:0)

您可以查看以下链接:

https://laravelcollective.com/docs/5.3/html

HTML Forms Facade所需的所有文档!

您正在使用Laravel 5.3