Labels

php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Monday, April 23, 2018

Create tables dynamically from user input using PHP

In this tutorial we are going to learn about how to generate table columns and rows dynamically from user input. 

Very simple code generate dynamic table.


Here is the code.

PHP code get requested number of columns and rows through loops and then simply display the table.

You always can make it more attractive by adding CSS styles.   



<?php
 
$createtable = '';
if ($_POST){

        $createtable .= '<table border="1">';
for ($i = 0; $i < $_POST['line']; $i++) {

$createtable .= '<tr>';
for ($j = 0; $j < $_POST['colunn']; $j++) {

$createtable .= '<td width="50">&nbsp;</td>';
}

$createtable .= '</tr>';
}

$createtable .= '</table>';
}

?>

<form action="" method="post">

<table border="0" width="200">

<tr>
<td width="80"><label>Column:</label></td>
<td width="120"><input type="text" name="colunn"></td>
</tr>

<tr>
<td><label>Line:</label></td>
<td><input type="text" name="line"></td>
</tr>

<tr>
<td colspan="2" align="right">
<input type="submit" value="Create Table">
</td>
</tr>

</table>

</form>

<?php

echo $createtable;

 ?>



For any queries or any new code requests comment below in the comment section.

40 comments:

  1. If you are going for most excellent contents like I do, simply pay a quick visit this web site all the time as it provides quality contents, thanksLed High Bay Lights

    ReplyDelete
    Replies
    1. IEEE Project Domain management in software engineering is distinct from traditional project deveopment in that software projects have a unique lifecycle process that requires multiple rounds of testing, updating, and faculty feedback. A IEEE Domain project Final Year Projects for CSE system development life cycle is essentially a phased project model that defines the organizational constraints of a large-scale systems project. The methods used in a IEEE DOmain Project systems development life cycle strategy Project Centers in Chennai For CSE provide clearly defined phases of work to plan, design, test, deploy, and maintain information systems.


      This is enough for me. I want to write software that anyone can use, and virtually everyone who has an internet connected device with a screen can use apps written in JavaScript. JavaScript Training in Chennai JavaScript was used for little more than mouse hover animations and little calculations to make static websites feel more interactive. Let’s assume 90% of all websites using JavaScript use it in a trivial way. That still leaves 150 million substantial JavaScript Training in Chennai JavaScript applications.

      Delete
  2. Impressive!Thanks for the post-
    For complete solution from Quick Attestation Services Pvt.Ltd. Please call on our Helpline No.9911382286 OR fill the form below :
    http://www.quickattestationservices.com/contact.html
    OR
    FOLLOW OUR FACEBOOK PAGE:
    https://www.facebook.com/QuickAServices/
    AND
    JOIN FACEBOOK GROUP :
    https://www.facebook.com/groups/220497138530592/
    OR
    TWITTER PAGE:
    https://twitter.com/QuickAServices

    ReplyDelete
  3. Wonderful Article.Enjoyed reading the article above.

    Office.com/Setup

    ReplyDelete
  4. Led High Bay obviously appreciate your site and you ought to write more.

    ReplyDelete
  5. Led High Bay Thanks for the great writeup. This the fact is once were some sort of pleasure bank account this.

    ReplyDelete
  6. I like to read your posts because of it's good quality.
    Visit architectural design studio!

    ReplyDelete
  7. We deliver excellence and our prices are competitive.
    As specialist web designers and website developers for London and other UK cities, we use WordPress to design, build and manage high traffic websites with fast load times to make it easy for customers to use while also boosting traffic, revenue and making the web faster for all. We deliver excellence in website design, development and SEO.

    if you want more just look here "Website design"

    ReplyDelete
  8. Thanks for sharing the valuable information. if you need to know about Web Design and Development updates or service please contact Digital Links. We are a digital marketing agency in UAE and Qatar.

    ReplyDelete
  9. Nice post.
    The best email tech support, call Roadrunner Email Tech Support Phone Number +1-888-338-6033.

    ReplyDelete
  10. Thanks for the post. Jobschampions is an online job board based in the UK providing job search and recruitment services for over 35 job sectors

    Find jobs today and apply direct to employers for jobs in the UK jobs by location:

    ReplyDelete
  11. For job search and latest job vacancies connect employers with job seekers and vice versa; skillsrecruitment we do this by helping employers and recruitment agencies advertise their job vacancies. savannarecruitment We then take these jobs to potentially suitable candidates and job seekers on-line via different devices so they can apply for latest jobs visit jobschampions , jobsonly , jobschampions.com , applytojobs , jobboss

    ReplyDelete
  12. Creating table dynamically was tough but after the explaintion and the code which you have shown here it seems easy to me. I will ret this code for my php form with POST method. Thanks for the easy code! psd to wordpress

    ReplyDelete
  13. You made some first rate points there. I seemed on the internet for the difficulty and located most people will go along with together with your website.Exide Battery Dealers in Chennai

    ReplyDelete
  14. Hello.This post was extremely fascinating, particularly because I was searching for thoughts on this issue last Tuesday. google adwords certification singapore

    ReplyDelete
  15. The accounting program comes multi-user ready and "value packs" for 3 or more users are available. Peachtree accounting software is also available in Premium and First Accounting versions.

    government grants

    ReplyDelete
  16. In the era of Web 2.0, the web has gone interactive. Social networking is a buzzword these days.DB Designer

    ReplyDelete
  17. I'm still learning from you, while I'm trying to reach my goals. I absolutely enjoy reading everything that is written on your site.Keep the posts coming. I loved it! marketing executive singapore

    ReplyDelete
  18. Kanhasoft is one of the best PHP Web Application Development Company in India and USA. We are delivering successful projects on CRM software development, ERP software development, Marketplace seller application, Web and Mobile application development to offshore clients from major countries like USA, UK, Japan, Canada, Singapore, Australia, Sweden, Norway, Switzerland, New Zealand, Germany and South Africa. We work on major technologies like PHP( Yii, Laravel, and CodeIgniter), Java, Angular JS, Node JS, iOS, Android, React Native, .Net and Python(Django).

    ReplyDelete
  19. They programmers can switch to the most recent version of the widely used server-side scripting language to improve the load speed of websites without putting extra time and effort.https://medijo.lt/plakatai/

    ReplyDelete
  20. You made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us to read this..
    web designers long island

    ReplyDelete
  21. I think this is one of the most significant info for me. And i'm glad reading your article. But want to remark on few general things, The site style is ideal, the articles is really excellent : D. Good job, cheers buy domain singapore

    ReplyDelete
  22. I consider myself a problem solver, inventor, multi-disciplinarian, gardener and leader. I'm drawn to formulating new ideas around objects, people and motives using thesis building.

    if you want more just look here "Job Interview"

    ReplyDelete
  23. Hey! Do you know if they make any plugins to help with Search Engine Optimization? I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good gains. If you know of any please share. Cheers! email marketing campaigns

    ReplyDelete
  24. hypothermia isn't like frostbite. you could have frostbite through itself or with hypothermia. it relies upon on the type. frostbite is an injury you get when a part of your body freezes. commonplace locations of frostbite are your nostril, ears, palms, and toes. with frostbite, your body parts may be numb, stiff, and/or white or grayish-yellow. the results can be long-time period for severe accidents. it is able to require amputation.

    if you want more just look here "Health Topics"

    ReplyDelete
  25. Racism is considered to be one of the major global problems of the present. That is the reason why professors draw their students’ attention to this pressing issue, giving them this topic to write about. Educational institutions promote a lifestyle that is democratic, tolerant, and free of any stereotypes relating to differences resulting from race or ethnic origin.

    if you want more just look here "https://propaperwritings.com/racism-essay-receive-a-brilliant-research-paper-at-an-affordable-price.html"

    ReplyDelete
  26. Thank you so much for sharing these amazing tips. We also provide Digital Signature Certificate

    ReplyDelete
  27. Thank you so much for providing such a useful content. Digital Signature Certificate

    ReplyDelete
  28. I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Class 2 Digital Signature Certificate

    ReplyDelete
  29. I highly admire your post. Thanks for sharing such wonderful information, I see your post very often and share them on all social media channels.
    Digital Signature Certificate in Delhi

    ReplyDelete
  30. I found your article very awesome thanks for sharing these information.You have very strong information about latest topic.
    Private Detective Agency in Mumbai

    ReplyDelete
  31. This is exactly what I was looking for. Thanks for sharing this great article. The quality of your articles and contents is great.
    Digital Signature Certificate in Delhi

    ReplyDelete
  32. Grateful to check out your website. Thank you so much for providing such useful content.
    NEGIS BOUTIQUE HOME STAY

    ReplyDelete
  33. The most importantly advantage of utilizing PHP programming is it is an open source server side programming language and is completely free, in spite of the fact that CakePHP Application Development

    ReplyDelete
  34. PHP was initially intended for use in Web webpage development, yet quickly developed to turn into a considerably more strong language.Why use Laravel

    ReplyDelete

More Posts

FOLLOW