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

  • Home
  • SEARCH
  • 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 6365475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:17:52+00:00 2026-05-25T00:17:52+00:00

I am facing a strange problem. My PHP page has following code. echo <div

  • 0

I am facing a strange problem.
My PHP page has following code.

echo "<div id='page_$i' class='layout_pages'>".eval('?>' . $layouts[$i]. '<?php ')."</div>";

Here $i is my iterator and $layouts is an Array which have multiple layouts fetched from database in it. Some layouts have PHP code in them. That’s why I am using eval function.

Now problem is that HTML output of this code is something like that

<div id='page_$i' class='layout_pages'></div>
//Layout output goes here

Ideally layout out should be wrapped in this DIV. But Div starts and closes before layout. Can you suggest me some good solution.

[Solved]

Well mates, I solved this issue by making following changes in code. Rather showing all data in one echo statement. I used multiple echo commands and everything is fine now. Thanks a lot for your suggestions.

<div id='page_<?php echo $i; ?>' class='layout_pages' ><?php echo eval('?>' . $layouts[$i]. '<?php '); ?></div>;

As i dun have 100 points. So cant answer my own question. That’s why i am editing my question 🙂

  • 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-25T00:17:53+00:00Added an answer on May 25, 2026 at 12:17 am

    The rogue eval function in there is probably the culprit, I would recommend doing it like this instead:

    echo "<div id='page_".$i."' class='layout_pages'>".$layouts[$i]."</div>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing this strange problem with the following section of code <% if
I am facing a strange problem while running my application. I have a class
I'm facing a strange problem right now... I'm trying to use Facebook API to
I am facing strange problem, Whenever I commented second if condition, it works in
I'm facing this strange problem. I'm trying to read a file that is located
I am facing a strange problem while sorting a list of strings with integer
I am facing this strange problem while working with Generic Base Classes. I am
I am facing a strange problem on my Ubuntu Karmic system. When I call
I am facing a strange problem with my iphone. It shows available memory as
I am facing a strange problem with AVAudioRecorder. In my application i need to

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.