Laravel Input:get() not working

2019-03-06 07:39发布

I'm trying to work on a post function in Laravel 4. My form has a number of fields that on submitting, goes to the post function in the controller.

The problem is, the fields in the form have names which have spaces between them.

For example, "Type 1" is a name of an input and it has a space in between. Now, when I'm trying to get that field's value by doing Input::get('Type 1'), it's not returning any value. But if I change the name in the form to "Type1", it returns the value entered.

Is there a solution to this problem? I can't remove the space because these are dynamic names coming from the database. They can be long names, one word or anything. So I can't keep a static solution.

I could probably take the id and use that to manipulate the data, but that would decrease the convenience. That would be my last resort. Any solutions?

Thanks in advance.

1条回答
乱世女痞
2楼-- · 2019-03-06 08:16

Spaces in name were converted to dash. In your case, try:

Input::get('Type_1');

查看更多
登录 后发表回答