Hello All:
I need help constructing a mysql statement to post data from the following form to db
<form id="updateHrs" name="updateHrs" method="post" action="process_updateHrs.php">
<table align=center class="ebc-table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="7"><?php echo $SBS_LANG['time_title']; ?></th>
</tr>
<tr>
<th class="sub">Days</th>
<th class="sub">Opens</th>
<th class="sub">Closes</th>
<th class="sub">Day Off</th>
</tr>
</thead>
<tbody>
<?php
include_once 'time.widget.php';
$i = 1;
foreach ($SBS_LANG['days'] as $k => $day)
{
if (isset($tpl['arr']) && count($tpl['arr']) > 0)
{
$hour_from = substr($tpl['arr'][$k.'_from'], 0, 2);
$hour_to = substr($tpl['arr'][$k.'_to'], 0, 2);
$minute_from = substr($tpl['arr'][$k.'_from'], 3, 2);
$minute_to = substr($tpl['arr'][$k.'_to'], 3, 2);
$attr = array();
$checked = NULL;
if ($tpl['arr'][$k.'_dayoff'] == "T")
{
$attr['disabled'] = 'disabled';
$checked = ' checked="checked"';
}
} else {
$hour_from = NULL;
$hour_to = NULL;
$minute_from = NULL;
$minute_to = NULL;
$attr = array();
$checked = NULL;
}
$step = 30;
?>
<tr class="<?php echo ($i % 2 !== 0 ? 'odd' : 'even'); ?>">
<td align=center><?php echo $day; ?></td>
<td align=center><?php echo hourWidget($hour_from, $k . '_hour_from', $k . '_hour_from', 'select w60', $attr); ?> <?php echo minuteWidget($minute_from, $k . '_minute_from', $k . '_minute_from', 'select w60', $attr, $step); ?></td>
<td align=center><?php echo hourWidget($hour_to, $k . '_hour_to', $k . '_hour_to', 'select w60', $attr); ?> <?php echo minuteWidget($minute_to, $k . '_minute_to', $k . '_minute_to', 'select w60', $attr, $step); ?></td>
<td align=center><input type="checkbox" class="working_day" name="<?php echo $k; ?>_dayoff" value="T" <?php echo $checked; ?> /></td>
</tr>
<?php
$i++;
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="7"><input type="submit" value="Save" class="" /></td>
</tr>
</tfoot>
</table>
</form>
My db table structure is like this:
DROP TABLE IF EXISTS `club_hrs`;
CREATE TABLE IF NOT EXISTS `club_hrs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`accountid` int(20) unsigned DEFAULT NULL,
`monday_from` time DEFAULT NULL,
`monday_to` time DEFAULT NULL,
`monday_dayoff` enum('T','F') DEFAULT 'F',
`tuesday_from` time DEFAULT NULL,
`tuesday_to` time DEFAULT NULL,
`tuesday_dayoff` enum('T','F') DEFAULT 'F',
`wednesday_from` time DEFAULT NULL,
`wednesday_to` time DEFAULT NULL,
`wednesday_dayoff` enum('T','F') DEFAULT 'F',
`thursday_from` time DEFAULT NULL,
`thursday_to` time DEFAULT NULL,
`thursday_dayoff` enum('T','F') DEFAULT 'F',
`friday_from` time DEFAULT NULL,
`friday_to` time DEFAULT NULL,
`friday_dayoff` enum('T','F') DEFAULT 'F',
`saturday_from` time DEFAULT NULL,
`saturday_to` time DEFAULT NULL,
`saturday_dayoff` enum('T','F') DEFAULT 'F',
`sunday_from` time DEFAULT NULL,
`sunday_to` time DEFAULT NULL,
`sunday_dayoff` enum('T','F') DEFAULT 'F',
PRIMARY KEY (`id`),
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
I would appreciate some help structuring the correct statement to save form data to db.
Thank,