我是laravel的新手。我在welcome.blade.php上有输入数据
的表单<form action='chart.php' method='post'>
<input type='text' name='job1' class='form-control' id="job1" />
<input name='salary1' type='text' class='form-control' id="salary1" />
<br>
<input type='text' name='job2' class='form-control' id="job2" />
<input name='salary2' type='text' class='form-control' id="salary2" />
我想将值发送到chart.blade.php,在那里创建图表,
我不知道如何制作邮寄路线
Route::post('chart', function()
{
return View::make('chart', array('job1' => $job1, 'salary1' => $salary1, 'job2' => $job2, 'salary2' => $salary2));
});
答案 0 :(得分:0)
您可以使用的最简单的表单,不使用控制器:
在您看来:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *incidentCell = [UITableViewCell alloc]init];
NSInteger row = [indexPath row];
NSDictionary *dic = [subIncidentArray objectAtIndex:row];
if ([[dic objectForKey:@"TemplateType"] isEqual:@1]) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 40, 300, 30)];
textField.delegate = self;
textField.tag = 1;
textField.text = self.contentOfTextField;
[incidentCell addSubview:textField];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.textColor = [UIColor grayColor];
if ([dic objectForKey:@"TextValue"] ==[NSNull null])
textField.text = [dic objectForKey:@""];
else
textField.text = [dic objectForKey:@"TextValue"];
}
return incidentCell;
}
在您的路线中:
<form action='chart' method='post'>
<input type='text' name='job1' class='form-control' id="job1" />
<input name='salary1' type='text' class='form-control' id="salary1" />
<br>
<input type='text' name='job2' class='form-control' id="job2" />
<input name='salary2' type='text' class='form-control' id="salary2" />
</form>
请注意:
Route::post('chart', function()
{
extract(request()->all());
return View::make('chart', array('job1' => $job1, 'salary1' => $salary1, 'job2' => $job2, 'salary2' => $salary2));
});
chart
request()->all()
函数将每个输入名称解析为变量(从数组键中生成变量)。