samedi 27 février 2016

HTML- and PHP-code inside an PHP 'if statement'

What if I want to have HTML code inside my 'if' statement, and then php code in the 'else' part? What do I do? I have tried this, but with no luck..

<?php

session_start();

if ($_SESSION['bnavn']) : ?>

   'HTML-code'

<?php else : ?>

    'PHP-code'
    
<?php endif: ?>

I have also tried this, but also with no luck:

<?php

    session_start();

    if ($_SESSION['bnavn']) : ?>

       'HTML-code'

    <?php else : ?>

        <?php 'PHP-code' ?>
        
    <?php endif: ?>

Aucun commentaire:

Enregistrer un commentaire