I have a variable holding the structure of a table, I want to add php code inside the table. I’ve tried adding the code statement to a variable and then fetching the variable data inside the table but I Think is not possible, what is the right way of doing it.
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">**ADD CODE HERE**</td></tr>
</table>';
echo $table;
Here is the code i want to add inside the column:
if($_SESSION['Mmsg']['Mreg-err'])
{
echo '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
echo '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}
I’ve tried adding the code inside $notification and then adding
$notification='if($_SESSION['Mmsg']['Mreg-err'])
{
echo '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
echo '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}';
‘ . $notification . ‘
Inside the table like:
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">' . $notification . '</td></tr>
</table>';
echo $table;
But is not possible, is there a way to achieve this? i am a newbie
EDIT added your unsets…