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 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';">

                            <p class="font_unik_comp" style="display:none;">Sunda Estates</p>
                            <p class="num_unika_size">' . $phone . '</p>

Recommended Answers

All 3 Replies

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

Member Avatar

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


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:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.