Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.