Program to show the table of a number in PHP

Program to show a table of a number till 10

In this tutorial, we will learn that how to print the table of a number and number will be input by the user.

For this purpose, we need to make two text boxes in a form and then assign names to each of the form element. For example, here we assign the following names.

  • Input type text is named as “value”.
  • Input type submit is names as “btn“.

Now we can put the values of form elements “value” and “btn” in some variable by POST method and further necessary actions will be carried out.


show table of a number in php
Figure: table of a number in php.
Line No Code Explanation
8 if(isset($_POST[‘btn’])) It will check that values are successfuly POSTED from form or not.
10 $n=$_POST[‘value’]; Right side takes the values from the form element (named as “value”) and this value is the value which is posted by user with the help of form.

Now we can put the value of right side into left side into the variable $n.

Program to show a table of a number till 20.

In this example, we will take the inputs from the user and store them in variables.


Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....

Leave a Reply