Welcome Guest, Not a member yet? Register   Sign In
Load a foreach statement on page load?
#1

[eluser]Unknown[/eluser]
Hi,

Im hopeful someone may know how to solve this (probably) simple issue im having.

I have a page with a form that enters data into a database table.Next to this form i have a foreach statement which displays the posts that have been entered using the form. (so a basic write and read)

When you initially go to the form page, the list of posts on the right does not load until data has been sent using the webform.

is there a way to load this piece of code everytime the page loads? So that you dont necessarily HAVE to use the form to display existing posts?

>
<?php if(isset($records)) : foreach($records as $row) : ?>
<h2 class="area_h">&lt;?php echo $row->name; ?&gt;</h2>
Deadline:&lt;?php echo $row->project_deadline; ?&gt;
<h3 class="a_h">&lt;?php echo anchor("site/delete/$row->id", 'Delete post'); ?&gt; </h3>
&lt;?php endforeach; ?&gt;

Thank you!


Messages In This Thread
Load a foreach statement on page load? - by El Forum - 02-10-2011, 08:18 AM
Load a foreach statement on page load? - by El Forum - 02-10-2011, 09:12 AM
Load a foreach statement on page load? - by El Forum - 02-10-2011, 09:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB