How to add an element with php

1

Good morning I wonder if you can create items like h1 , h2 , div or buttons in from

asked by jose marquez 17.04.2017 в 03:59
source

2 answers

7

You can write any HTML tag using the function echo of PHP, even create your entire web, make cycles for creating lists, etc. The result when you consult tupagina.com/pagina.php will be all the resulting HTML code.

For example:

<?php
    echo "<p>Hola Mundo</p>";
?>
    
answered by 17.04.2017 / 04:07
source
4

Add that in addition to the output functions like echo or print , you can do "code breaks" to get html directly.

<?php

    $var = 'foo';

    echo '<h1>Este texto concatena el valor de una variable ' . $foo . '</h1>';

    print "<h1>Este texto embebe el valor de una variable {$foo}</h1>";

    if ($var == 'foo') {
    ?>
    <h1>Esto es html</h1>
    <?php
    }
?>
    
answered by 17.04.2017 в 08:46