Jump to content

Correct way of using html with php


kartul

Recommended Posts

so far I've been making all submit pages with echoing html.

example:

if(!isset($_POST['submit'])) {
echo "<form method=\"post\" action=\"login.php\">
	<input .... 
";
}else {
$user = $_POST['user'];
$pass ...
// and then login part. checking some things and starting session.
}

 

as you can see. everything is huge php file with echoed html.

as i read from one site, all, html, js, css, php should be separated from each other.

so my question is, what is the correct way to display html in php files?

Link to comment
https://forums.phpfreaks.com/topic/164243-correct-way-of-using-html-with-php/
Share on other sites

I would just caution you a bit on using smarty as I've seen some people butcher a smarty template to the point where there was more code in the template than there was in the PHP.  The intent of smarty is to have template files with as little coding as possible to allow for the easy editing of HTML to change designs, make sure that if you go this route, you try and keep it that way.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.