PHP generated schedule table









up vote
-1
down vote

favorite












I'm making a schedule table using PHP to select a teacher's availability
I would like to make each cell selectable and track which one was selected in order to store in database.



PHP code :



$timestamps = ['11:00','11:40','12:20','13:00','13:40','14:20','15:00','15:40','16:20','17:00','17:40','18:20','19:00','19:40','20:20','21:00','21:40','22:20'];
$table = "";

for($i = 0; $i < 18; $i++)
$table .= "
<tr>
<th>".$timestamps[$i]."</th>";
for($k = 0; $k < 7; $k++)
$table .= "<td>".$i." - ".$k."</td>";

$table .= "</tr>";



HTML code:



<table class="table table-bordered" id="teacher-schedule">
<thead>
<tr>
<th></th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
</thead>
<?php echo $table; ?>
</table>









share|improve this question



















  • 1




    Your going to need to write some javascript. In the javascript code you will sign each cell with a unique id and then use ajax to do the required work server side.
    – Joseph_J
    Nov 11 at 2:17














up vote
-1
down vote

favorite












I'm making a schedule table using PHP to select a teacher's availability
I would like to make each cell selectable and track which one was selected in order to store in database.



PHP code :



$timestamps = ['11:00','11:40','12:20','13:00','13:40','14:20','15:00','15:40','16:20','17:00','17:40','18:20','19:00','19:40','20:20','21:00','21:40','22:20'];
$table = "";

for($i = 0; $i < 18; $i++)
$table .= "
<tr>
<th>".$timestamps[$i]."</th>";
for($k = 0; $k < 7; $k++)
$table .= "<td>".$i." - ".$k."</td>";

$table .= "</tr>";



HTML code:



<table class="table table-bordered" id="teacher-schedule">
<thead>
<tr>
<th></th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
</thead>
<?php echo $table; ?>
</table>









share|improve this question



















  • 1




    Your going to need to write some javascript. In the javascript code you will sign each cell with a unique id and then use ajax to do the required work server side.
    – Joseph_J
    Nov 11 at 2:17












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I'm making a schedule table using PHP to select a teacher's availability
I would like to make each cell selectable and track which one was selected in order to store in database.



PHP code :



$timestamps = ['11:00','11:40','12:20','13:00','13:40','14:20','15:00','15:40','16:20','17:00','17:40','18:20','19:00','19:40','20:20','21:00','21:40','22:20'];
$table = "";

for($i = 0; $i < 18; $i++)
$table .= "
<tr>
<th>".$timestamps[$i]."</th>";
for($k = 0; $k < 7; $k++)
$table .= "<td>".$i." - ".$k."</td>";

$table .= "</tr>";



HTML code:



<table class="table table-bordered" id="teacher-schedule">
<thead>
<tr>
<th></th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
</thead>
<?php echo $table; ?>
</table>









share|improve this question















I'm making a schedule table using PHP to select a teacher's availability
I would like to make each cell selectable and track which one was selected in order to store in database.



PHP code :



$timestamps = ['11:00','11:40','12:20','13:00','13:40','14:20','15:00','15:40','16:20','17:00','17:40','18:20','19:00','19:40','20:20','21:00','21:40','22:20'];
$table = "";

for($i = 0; $i < 18; $i++)
$table .= "
<tr>
<th>".$timestamps[$i]."</th>";
for($k = 0; $k < 7; $k++)
$table .= "<td>".$i." - ".$k."</td>";

$table .= "</tr>";



HTML code:



<table class="table table-bordered" id="teacher-schedule">
<thead>
<tr>
<th></th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
</thead>
<?php echo $table; ?>
</table>






php mysql html-table schedule






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 9:13









Brian Tompsett - 汤莱恩

4,153133699




4,153133699










asked Nov 11 at 1:58









Dominique Abou Samah

144




144







  • 1




    Your going to need to write some javascript. In the javascript code you will sign each cell with a unique id and then use ajax to do the required work server side.
    – Joseph_J
    Nov 11 at 2:17












  • 1




    Your going to need to write some javascript. In the javascript code you will sign each cell with a unique id and then use ajax to do the required work server side.
    – Joseph_J
    Nov 11 at 2:17







1




1




Your going to need to write some javascript. In the javascript code you will sign each cell with a unique id and then use ajax to do the required work server side.
– Joseph_J
Nov 11 at 2:17




Your going to need to write some javascript. In the javascript code you will sign each cell with a unique id and then use ajax to do the required work server side.
– Joseph_J
Nov 11 at 2:17

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245198%2fphp-generated-schedule-table%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245198%2fphp-generated-schedule-table%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto