WordPress.org

Ready to get started?Download WordPress

Forums

"echo str_replace" within an echo and if statement? (1 post)

  1. cwebb41
    Member
    Posted 1 year ago #

    Having trouble with a "echo str_replace" command within an echo. The code below outputs 3 layers when conditions are met. The "echo str_replace" command and the first two layers work, but having trouble with the third layer. How can you insert the "echo str_replace" to output into the third layer.......

    <?php
    if($item->product_id == '2'){
    if($item->quantity == '2') { echo '<img src="ticket2.jpg">';
    echo '<div id="Layer1"> '. $name->first_name . '</div>'; }

    elseif($item->quantity == '3') { echo '<img src="ticket3.jpg" >';
    echo '<div id="Layer2"> ' . $name->last_name . '</div>';
    echo '<div id="Layer1"> ' . $name->middle_name . '</div>';

    ; }

    else { echo '<div id="Layer3"> ' . $name->middle_name . echo str_replace("'", "'", $item->description);
    '</div>';
    }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic