Jump to content

Create a table like a spreadsheet


liamrlph

Recommended Posts

Hi everyone,

 

I'm kind of confused on how to do this. I want to create a table similar to a spreadsheet that will look something like:

 

[/td]201020112012

Monday10

Tuesday15

Wednesday[td]

 

The values will just be integers which I would like to be able to edit. For example the cell for Tuesday 2010 might be 10. Anyone can help or show me something that will. I appreciate any help. Many Thanks,

 

Liam

Link to comment
https://forums.phpfreaks.com/topic/203868-create-a-table-like-a-spreadsheet/
Share on other sites

A simple sample of something like this?

<html>
<head>
<style type="text/css">
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
</style>
</head>

<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Savings</th>
</tr>
<?php
while($my_variable > $count)//loop something here for number of rows you want
{
    echo "<tr>"; // begin of a row
    for($i=0;$i<4;$i++) // loop through 3 time to match three header columns
          {
   echo('<td>Lois</td>
            <td>'.$variable.'</td>
            <td>$150</td>');
           }
  echo "</tr>" //end of a row
$my_variable--;
}
?>
</table>
</body>
</html>

If, as you mentioned, you like to edit values in such spreadsheet, there need to be a html form with input text fields (integrated to the html code suggested by gwolgamott). Also to store edited values you'll need to save them to database or text file.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.