The database stores the entry Mobile phones. So, when sampling and substitution in the value attribute, Laravel wraps the first word in quotes - "Mobile", and ignores the word telephones. Tell me how to remedy the situation, because I need to continue to make another selection for this record.

enter image description here

Sample:

$category = DB::table('category')->get(); 

Value Substitution:

 @foreach($category as $c) <li> <form action="{{url("/selectProduct")}}" method="post"> <input class="submit" type="submit" name="categoryName" value= {{$c->name}}> {{ csrf_field() }} </form> </li> @endforeach 
  • It should be displayed in the form in which it is. Check the value of $ c-> name. And do the substitution value = "{{$ c-> name}}" - RaZik
  • Damn, thank you. About quotes forgot in value. Now displays as needed) Thank you) - Andrew

1 answer 1

The value attribute value must be enclosed in quotes:

 <input class="submit" type="submit" name="categoryName" value="{{$c->name}}">