Muhammad Muazzam Muhammad Muazzam - 6 months ago 25
HTML Question

Page breaks on php tag

The following code is written in php file and breaks page

<?php

$myrows1=cpabc_player_plan();

foreach ($myrows1 as $index=>$item1) //start foreach party plan
{
if ($item1 === reset($myrows1))
{}
?>

<?php }?>


while if I use it as

<?php
$myrows1=cpabc_player_plan();

foreach ($myrows1 as $index=>$item1) //start foreach party plan
{
if ($item1 === reset($myrows1))
{}
}?>


then it works fine.

Answer

You can use foreach(): endforeach Block like this:

<?php foreach ($myrows1 as $index=>$item1): ?>
  <h1> some html tags</h1>
   <?php
     if ($item1 === reset($myrows1))
       {}
   ?>
  <h1> some html tags</h1>
<?php endforeach; ?>

for other php statements you can read this page.