Home Ask Login Register

Developers Planet

Your answer is one click away!

javed71 February 2016

Adding an Image Input Element in Laravel Blade Template

I want to upload a image using input tag in laravel Blade Template with the following line ..

{{ Form::image('blog/images/search_btn.gif', 'button_search', ['class' => 'button_search']) }}

But it continuously showing Error in the view page

syntax error, unexpected 'content' (T_STRING), expecting ']'

This is my View Page Code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<div class="main">
  <div class="header">
    <div class="header_resize">
      <div class="menu_nav"> 
          <li><a href="index.html">Home</a></li>
          <li><a href="support.html">Support</a></li>
          <li class="active"><a href="about.html">About Us</a></li>
          <li><a href="blog.html">Blog</a></li>
          <li><a href="contact.html">Contact Us</a></li>
        <div class="clr"></div>
      <div class="searchform">
        <form id="formsearch" name="formsearch" method="post" action="#">

           {{ Form::image('blog/images/search_btn.gif', 'button_search', ['class' => 'button_search']) }}
          <!--   {!! Html::image('blog/images/search_btn.gif', 'alt', array( 'class' => 'button_search' )) !!} 
           {{ Form::image('blog/images/search_btn.gif', 'button_search', ['class' => 'button_search]        


noodles_ftw February 2016

You are missing a closing ' on line 31:

{{ Form::image('blog/images/search_btn.gif', 'button_search', ['class' => 'button_search]) }}

Should be:

{{ Form::image('blog/images/search_btn.gif', 'button_search', ['class' => 'button_search']) }}

Also if you're working with Blade, use Blade's comment syntax instead of HTML's:

<!-- This is a HTML comment -->

{{-- This is a Blade comment, any blade code within this comment won't be parsed. --}}

Post Status

Asked in February 2016
Viewed 3,936 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life