HTML Basics in PHP Programming

HTML basics in PHP Language

Hello, Guys, Today we will see some basic concepts of Printing in PHP Programming Language. If you are already experienced in programming before, this tutorial will be a lot easier for you. For the newbies starting out in PHP, don’t worry just follow the article, try to understand syntax by rewriting codes in your own style 5 6 times. So let’s start our tutorial on HTML basics in PHP Programming.

  1. Printing Text on Screen in PHP

     HTML basics in PHP Language
    HTML basics in PHP Language
    //Printing Basics For Everyone
    echo "Hello Ladies and Gentlemens";
    echo "<br>";

    TO print text on screen -> Simply write text in between double quotes. To use HTML tags, we enclose tags in double quotes itself. For Example- “<h1>Programminng Jesus</h1>”

  2. Concatenation of Strings in PHP (Joining 2 Strings)

    echo "<h1>Making Codes Easy</h1><br>";
    echo "Joining"." Two"." Statements";
    //We use . (dot) operator for concatenation. Simple use . in between two strings
    and it will automatically concatenate them.
    echo "<br><br>";
    echo $age;
    echo "<br>". $age . "<br>"; //Put variable and concatenate accordingly. 
    NOTE: If You want to print out value of a variable- You can print it out 
    by putting variable inside or outside the Double quotes.

    LEARN: How to use Functions in PHP

  3.  HTML basics in PHP – Making An HTML Table using PHP

    echo "<br><br>";
    //Making HTML Table using php
    echo "<table border=1>"; // As i told you earlier, 
    we will use html tags in echo statement using Double Quotes.
    echo "<tr>";
    echo "<td> Column 1 </td>";
    echo "<td> Column 2 </td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td> Column 3 </td>";
    echo "<td> Column 4 </td>";
    echo "</tr>";
    echo "</table>";

    Above Section of code is quite explainatory. If you have any doubt regarding the concept, open up this article. Learn: How to Create Colorful Table using HTML and PHP

  4.  HTML basics in PHP : Writing Colorful text

    echo "<p style=color:red>My Name is Macky</p>";
    echo "<br>";
    //We can use inline CSS
  5. Printing using for Loop

     HTML basics in PHP Language 
    echo "<p style=background-color:lightblue>".$i."</p>";


    //Thou it has nothing much to do in HTML in For loop, but just for better understanding. If you have any doubt in this, please let me know via comments below. I will post a new article soon on Using Loops in PHP programming.

  6. HTML Basics in PHP – Creating HTML Form

    HTML Forms for PHPHTML Forms basics for PHP Programmers

Simply we are making an example HTML form. with 2 text boxes and 1 submit button.

<form name="frm1">
<input type="text" placeholder="Enter Your Name" name="col1">
<input type="text" placeholder="Enter Your Age" name="col">
<input type="Submit">


Final Output of All Code:

If you liked this article and learnt the HTML basics in PHP Language, please do share our article on at least one social media, We are trying hard to reach more people with our quality content, without your support we are nothing. Please do share this article and join the newsletter of Programmingy. You can check our complete PHP Programming Tutorial series.


Please enter your comment!
Please enter your name here