PHP code to display MySQL data in an HTML table

By | July 19, 2016

A simple HTML form containing fields – Name, Address Line1, Address Line2, and E-mail. On submitting the form, the data is inserted into MySQL table using PHP code. We will iterate over each record present in the table to display MySQL data in an HTML table.

 

 

The following image shows how the UserData.html looks on the browser:
HTML form to insert data in to MySQL table

 

Suggested Read:

 

 

The following image shows how the Display.php looks on the browser:

PHP code to display MySQL data in an HTML table

display MySQL data in an HTML table


How to execute this code?

  1. You need to copy files UserData.html and Display.php to a PHP server. You can use wampserver software which provides an integrated environment to run PHP files along with the MySQL database server.
  2. Next, open this HTML file in the browser via localhost URL. Usually http://localhost/UserData.html
  3. Enter user details and submit the data.
  4. You should be able to see the results displayed on the same browser via Display.php file.



Author: Ravi Bandakkanavar

A Techie, Blogger, Web Designer, Programmer by passion who aspires to learn new Technologies every day. It has been 6 years since I have been publishing articles and enjoying every bit of it. I want to share knowledge and build a great community with people like you.

Suggested articles for you:

Did it help? Comment here..