سؤال

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.

هل كانت مفيدة؟

المحلول

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

Input::get('Type_1');

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top