Hi Guys..
Basically i have table contain dates at the top and name on side and i want to save their start time(listbox) and finish time into database according to that name and the date..i tired by giving id but now i dont know how to obtain selected time…? ?
my code below
[code=php]<table border=”1px” id=”shift”>
<tr>
<td>Names</td>
<?php
$ts = strtotime($thisweek);
// find the year (ISO-8601 year number) and the current week
$year = date(‘o’, $ts);
echo “<form action=” method=’GET’>”;
echo “<select name=’week’>”;
for ($i=1;$i<53;$i++)
{
if($i<10)
{
$i=”0″.$i;
}
echo “<option value=’$i’>”;
echo $i;
echo “</option>”;
}
echo “</select>”;
echo “<input type=’submit’ value=’submit’/>”;
echo “</form>”;
if(isset($_GET[‘week’]))
{
$week=$_GET[‘week’];
}
else
{
$week = date(‘W’);
}
// print week for the current date
for($i = 1; $i <= 7; $i++) {
// timestamp from ISO week date format
$ts = strtotime($year.’W’.$week.$i);
echo “<td id='”.date(“Y-m-d”, $ts).”‘>”.date(“d-m-Y “, $ts) . “</td>”;//adding value to TD
}
?>
</tr>
<?php
$query=mysql_query(“SELECT * FROM shift”);
echo “<form action=” method=’GET’ >”;
while($resullt=mysql_fetch_assoc($query))
{
$dbName= $resullt[‘Name’];
$dbDate=$resullt[‘Date’];
$dbID=$dbName.” “.$dbDate;
echo “<tr>”;
echo “<td id=’$resullt[Name]’>$resullt[Name]</td>”;
for($i=1;$i<8;$i++)
{
$ts = strtotime($year.’W’.$week.$i);
// id='”.$resullt[‘Name’].” “.date(“Y-m-d”, $ts).”‘
echo “<td >”;
echo “Start:<select name=’Start’ id='”.$resullt[‘Name’].” “.date(“Y-m-d”, $ts).”‘>”;
echo “<option value=’12’>12</option>”;
echo “<option value=’11’>11</option>”;
echo “<option value=’10’>10</option>”;
echo “<option value=’9′>9</option>”;
echo “</select>”;
echo “Finish:<select name=’Finish’ id='”.$resullt[‘Name’].” “.date(“Y-m-d”, $ts).”‘>”;
echo “<option value=’9′>9</option>”;
echo “<option value=’8′>8</option>”;
echo “<option value=’7′>7</option>”;
echo “<option value=’7′>6</option>”;
echo “</select>”;
echo”</td>”;
}
echo “</tr>”;
}
echo “<input type=’submit’ value=’Save Shift’/>”;
echo “</form>”;
?>
<tr>
<td></td>
<td></td>
</tr>
</table>
please help or suggest on how can i archive thanks,