Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:15:18+00:00 2026-05-28T08:15:18+00:00

I echoing the contents of a table using foreach, the problem I am getting

  • 0

I echoing the contents of a table using foreach, the problem I am getting is the date is always at the top of the page, so when looking at my one line preview I just get the date and nothing more. If I remove the date it is fine and you can see the first line of the template. So I am trying to remove the date tag from the preview using for each.
I am using the following code, but it doesnt seem to be doing a lot, as far as I can see I have things right ?.

    echo '<div class="messagerow">';
// this pulls the message from the foreach above it
    $emlmsg = $row->emailformmessage;
// I am trying to remove the date by replacing it with the blank contents of this string value.
    $dateremove = '';
    // This is the str_replace that is supposed to remove the {date} tag along with the paragraph tags it is wrapped in.
$emlmsgfiltered = str_replace(array('<p>{date}</p>'), array($dateremove), $emlmsg);
// I then echo the filtered message here, minus the date....but its still there ??
echo $emlmsgfiltered;
echo '</div>';

Edit >>>>>>

 As requested, this is the html code

<p>{date}</p>

<p>Dear {name} thankyou for your order, if you need any more oil we will be happy to provide you with     a competitive quote.</p>

<p>Kind Regards</p>

{createdby}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:15:19+00:00Added an answer on May 28, 2026 at 8:15 am

    sorry . should have been an ansewr, not a comment:

    why the array around the first value in str_replace()? are you supposed to be referencing an array element

    str_replace('<p>{date}</p>',$dateremove,$emlmsg)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am echoing images out on a page using php but the images and
I'm getting a problem. I'm using Ubuntu and all my files are located in
I'm getting some pages with the get_pages function and echoing the page content like:
I am echoing back these 2 variables in to a table, but wanted to
I am using file_put_contents($file, $data); function for putting contents in file, because these files
I'm having a problem with CakePHP. My application is not echoing out any non-English
I am using file_get_contents to grab a page, but i need to replace some
I'm looking to echo out some content which is collected from a source using
I'm echoing a php string variable into html <span class=title_resource> <?php echo $titulo; ?>
I have a php loop that is echoing out geolocation values. How can I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.