PHP assigning a condition statement to a variable?
<p>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.</p>

<pre><code>$table='&lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;
        &lt;td width="638" valign="top"&gt;**ADD CODE HERE**&lt;/td&gt;&lt;/tr&gt;
        &lt;/table&gt;';
echo $table;
</code></pre>

<p>Here is the code i want to add inside the column:</p>

<pre><code>if($_SESSION['Mmsg']['Mreg-err'])
    {
        echo '&lt;div class="err"&gt;'.$_SESSION['Mmsg']['Mreg-err'].'&lt;/div&gt;';
        unset($_SESSION['Mmsg']['Mreg-err']);
    }       
if($_SESSION['Mmsg']['Mreg-success'])
    {
        echo '&lt;div class="success"&gt;'.$_SESSION['Mmsg']['Mreg-success'].'&lt;/div&gt;';
        unset($_SESSION['Mmsg']['Mreg-success']);
    }
</code></pre>

<p>I've tried adding the code inside $notification and then adding </p>

<pre><code>$notification='if($_SESSION['Mmsg']['Mreg-err'])
    {
    echo '&lt;div class="err"&gt;'.$_SESSION['Mmsg']['Mreg-err'].'&lt;/div&gt;';
        unset($_SESSION['Mmsg']['Mreg-err']);
    }       
    if($_SESSION['Mmsg']['Mreg-success'])
        {
        echo '&lt;div class="success"&gt;'.$_SESSION['Mmsg']['Mreg-success'].'&lt;/div&gt;';
        unset($_SESSION['Mmsg']['Mreg-success']);
        }';
</code></pre>

<blockquote>
  <p>' . $notification . '</p>
</blockquote>

<p>Inside the table like:</p>

<pre><code>$table='&lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;
            &lt;td width="638" valign="top"&gt;' . $notification . '&lt;/td&gt;&lt;/tr&gt;
            &lt;/table&gt;';
echo $table;
</code></pre>

<p>But is not possible, is there a way to achieve this? i am a newbie</p>
