Monday , 25 September 2023
Breaking News
Home > Tutorials > PHP > Better Way to Manage HTML Tags With PHP

Better Way to Manage HTML Tags With PHP

There are many approaches to write your code in nice method but nowadays I am working on html function method to write my code. If your are developing a site which is based on Bootstrap, then I have a good trick for you. Let’s assume that you are using following lines for getting input:

And this structure is repeating many times on one page and then on other pages then what will you do? Will you write each of these lines over and over and over… or you have some better idea?

I have an idea. Let’s convert these lines into a custom function. See the function below:-

Now implement this code is as under:

And you have done. One line is equal to several lines and two lines are equal to several and several lines and so on………

The idea is very simple just write a function and put all of your HTML code and put necessary parameters and enjoy. In the above PHP code you are calling a function html_input which I have written for you. You can use this function everywhere into your site.


About Muhammad Faryad

Muhammad Faryad is a professional web application developer. He has been working for 5 years in ICE786 Technologies Pvt. Ltd as a Senior Programmer and Developer. You can contact him on facebook at

Leave a Reply

Ad Test

%d bloggers like this: