Skip to main content

Create table using for loop in PHP

Here, at phptpoint we begin from the scratch where we can lead you on the practice of these languages.

This is a free and online site where the students who want to build a career in the same profession, can be trained about the working of the PHP.

Perhaps you can go to any of the Php Tutorial where you have to spend a hefty amount also and apart from that you need to give time as well. But here at Phptpoint, we provide functional and easy to understand PHP tutorials for beginners with examples.

Apart from free online tutorial Phptpoint provides you free downloading facility also. Students can easily download free php projects.

Create table using for loop in PHP

<?php

if(isset($_POST['create']))

{

$rows=$_POST['r'];

$cols=$_POST['c'];

echo "<table border='1'>";

for($i=0;$i<$rows;$i++)

{

echo "<tr>";

for($j=0;$j<$cols;$j++)

{

echo "<th>"."r".$i."c".$j."</th>";

}

echo "</tr>";

}

echo "</table>";

}

?>

<html>

<body>

<form method="post">

<table width="400" border="1">

<tr>

<td width="177">Enter number of rows </td>

<td width="207"><input type="text" name="r"/></td>

</tr>

<tr>

<td>Enter number of column </td>

<td><input type="text" name="c"/></td>

</tr>

<tr>

<td colspan="2">

<input type="submit" value="Create Table" name="create"/>

</td>

</tr>

</table>

</form>

</body>

</html>

r0c0r0c1r0c2
r1c0r1c1r1c2
r2c0r2c1r2c2
Enter number of rows
Enter number of column

Comments

Popular posts from this blog

Python Tutorial for Beginners

Learn Python with Industrial Experts with Examples Python is a popular general-purpose high-level, interactive and object-oriented scripting language that was invented by Guido Rossum in 1990. Python programming is commonly used in Computing Science in Artificial Intelligence, Human language Generation, Neural Networks and other specialized fields. Python for beginners , it has a basic syntax that is easy to use. That makes Python an outstanding language for novice to learn technology. Why Learn Python It is the most common and rapidly growing programming language of the present time. Here are 10 explanations for learning Python:   1.  It is simple and easy to understand  2.  It is very popular and on-demand  3   It has several libraries and frameworks  4.  It is often used in Data science  5.  It is often used in Artificial Intelligence and Machine Learning  6....

SEO Website Audit

SEO Audit How to Perform an SEO Audit of your website? An SEO audit defines as the process of examining the functioning and presence of the site in numerous areas. With the help of this, one can find basic issues of the websites that require improvement as well as prevent the websites from the scams. In addition to it, it also keeps your websites updated with updates related to the rankings that are upgraded by Google. Apart from it, you can also take help from SEO tutorials.  Areas covered by an SEO audit:   An audit covers numerous areas. Here is the list of some significant areas. ●   Ensure you about Problematic codes - It gives the information about the reason that causes your website ranking down or slows it down. You can either hire the web developer or take guidance from SEO tutorial to resolve this problem ●  Keywords - It shows you the usage of keywords is well placed, on a point or not. Crawling audit - It commences with cra...

Best Way To Learn SEO

Learn SEO Before learning the subject, let’s understand something about it. Search engine optimization (SEO) is basically a process of improving the positions in the organic (non-paid) search results in the search engines. Please note that the higher the website is, the more people will be able to see it. The history of the SEO go back to the 90s when there were search engines emerged as for the first time. Nowadays, it is an essential marketing strategy and also an ever-growing industry.  Even the basic can change can usually make a very big difference in the terms that how search engines will see your website. In order to learn SEO , one should learn the basics of it from an SEO guide for beginners that is available on the web generally with all the points that cover all the critical topics and the basics.   The good thing about learning is that you’ll find basically tons of the information on the internet for free but the user should be able to ...