0

i have an echo statement. which am looping columns. and i want to use this onerror command
<img src="http://subinsb.com/to-an-image" onerror="this.src='img/delogo.jpg';"/>
but not working. how do i do this. thanks

  echo '  <div class="col-lg-5 col-md-5 col-xs-12">
                            <h4 class="font_head_check">' . $title . '<span class="box_type_unik">For Sale</span></h4>
                            <p class="font_check">' . $town . '</p>
                            <span class="label label-info">GH¢ ' . ($currency == 2 ? number_format($price * $ratio) : number_format($price)) . '</span>
                            <span class="label label-default"></span>
                            <p class="agent_det_unika"><br/>' . substr($description, 0, 400) . '</p>

                        </div>
                        <div class="vertical-line" style=""></div>
                        <div class="col-lg-2 col-md-2 col-xs-12 col_comp_img">

                            "<img src="'.$logo.'" class="img-responsive result_comp_logo" onerror="this.src='img/delogo.jpg';">


                            <br/>
                            <p class="font_unik_comp" style="display:none;">Sunda Estates</p>
                            <p class="num_unika_size">' . $phone . '</p>
                        </div>
                    </div>';
2
Contributors
3
Replies
17
Views
1 Year
Discussion Span
Last Post by diafol
0

i can get it working in normal html but fixing it in the php echo statement is my issue.Thanks

0

Placing all that HTML into a PHP string is just insane. Why on earth are you doing this? Anyway, your funeral...

onerror="this.src='img/delogo.jpg';"

If you have to have those single quotes in the string, then you must escape them as your using a single quoted string in PHP:

onerror="this.src=\'img/delogo.jpg\';"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.