How to create HTML page with PHP [closed]

0

I do not have much knowledge and I do not know if the way I'm doing is correct or has some negative point. Are there any better options for me to do?

<?php
$ht = '<div class="panel panel-headline">';
$ht .= '<div class="panel-heading">';
$ht .= '<form id="searchthis" method="get">';
$ht .= '<input id="namanyay-search-box" name="search" size="40" type="text" placeholder="Search"/>';
$ht .= '<button id="namanyay-search-btn" type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i></button>';
$ht .= '</form>';
$ht .= '<h3 class="panel-title">Manage OneDrive Videos</h3>';
$ht .= '</div>';
$ht .= '<div class="panel-body" style="overflow: auto;">';
$ht .= '<table class="table table-hover">';

echo $ht;
?>
    
asked by anonymous 23.11.2018 / 14:08

1 answer

3

In general, it's okay to do this, but people often use the template system, that is, they place HTML in the first place and place PHP code in the necessary gaps. What is not the case with this code, ie this example should be a static HTML page that does not even go through the PHP processor, it would be absurdly faster.

Very basic example of how to do it:

<html>
    <head>
        <title>PHP Test</title>
    </head>
    <body>
        <p><?php echo "1 + 1 é " . (1 + 1); ?></p>
    </body>
</html>

See running on ideone . And no Coding Ground . Also I placed GitHub for future reference .

Of course, the example is silly and so would not need to go through PHP, but it gives an idea of how it is more common. What you would probably do is a page that would receive the value sent by your example and would deal with a final result that would be delivered to the browser.

    
23.11.2018 / 14:15