Im strunggling to validate each input box that my senior made and
I dont know how to figure it out..any help would be appreciate!
TQ in advance! u guys rock!
Code:
<html>
<head>
<title><?php echo $row_rs1['title']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../pnec.css" rel="stylesheet" type="text/css">
<Script language="JavaScript"> // this section im very confuse
function checkForm()
{
var timeFrom, timeFrom1, timeTo, timeTo1;
with(window.document.msgform)
{
ctime1 = timeFrom;
ctime2 = timeFrom1;
ctime3 = timeTo;
ctime4 = timeTo1;
}
if(trim(ctime1.value) == '')
{
alert('Please enter your time from');
ctime1.focus();
return false;
}
else if(trim(ctime2.value) == '')
{
alert('Please enter your time from');
ctime2.focus();
return false;
}
else if(trim(ctime3.value) == '')
{
alert('Please enter your time to');
ctime3.focus();
return false;
}
else if(trim(ctime4.value) == '')
{
alert('Please enter your time to');
ctime4.focus();
return false;
}
else
{
ctime1.value = trim(ctime1.value);
ctime2.value = trim(ctime2.value);
ctime3.value = trim(ctime3.value);
ctime4.value = trim(ctime4.value);
return true;
}
}
function trim(str)
{
return str.replace(/^\s+|\s+$/g,'');
}
</script>
</head>
<body>
Welcome, <?php echo "".$_SESSION['username'];?>!</td>
<td> <img src="../frontpage-user/ec-layout-user-e5_23.gif" width="17" height="22" alt=""></td>
</tr>
<!-- ****************************************8Dropdown menu*******************************************8 -->
<tr>
<td colspan="9"></td>
</tr>
<tr>
<td></td>
<td colspan="7">
<table border="0" cellpadding="2" cellspacing="0" bgcolor="#FBE7C5">
<tr>
<td><div class="page_title_user"><font color="#9ACEDF">..</font> <font color="#6FB7D6">::</font> my Facilities Booking <font color="#6FB7D6">::</font><font color="#9ACEDF">..</font> </div></td>
</tr>
<tr bgcolor="#D6EDF0">
<td><div style="font-size:14px;" align="center"> Be mesmerized with the convenience of online facilities booking of community hall, badminton court, tennis court and other facilities provided for in the community. </div></td>
</tr>
<tr>
<td>
<?php
if(!isset($_POST['submit'])){
?>
<form action="" method="post" onSubmit="return (checkForm());">
<table width="98%" height="301" border="0" class="body" align="center" cellpadding="10" cellspacing="0" bordercolor="#FFFFFF">
<!--Step 3 : Select Time-->
<tr>
<td style="border-width:1px; border-color:#A8B2C6; border-style:solid;" class="body" colspan="2">
<div style="font-size:18px; color:#007E8C; font-weight:bold;"> <font color="#cccccc">3. </font>Select Time</div>
<br>
</td>
</tr>
<tr>
<td width="15%" class="body-facilities">From:</td>
<td class="body-facilities">
<input type="text" name="timeFrom" class="body" id="timeFrom" size="1" maxlength="2">
:
<input type="text" name="timeFrom1" class="body" id="timeFrom1" size="1" maxlength="2">
<sup style="color:#FF0000">eg: 08:00</sup> </td>
</tr>
<tr>
<td class="body-facilities">To:</td>
<td class="body-facilities">
<input type="text" name="timeTo" class="body" id="timeTo" size="1" maxlength="2">
:
<input type="text" name="timeTo1" class="body" id="timeTo1" size="1" maxlength="2">
<sup style="color:#FF0000">eg: 23:00</sup></td>
</tr>
<tr>
<td class="body-facilities"><sub>Operating Hour:</sub></td>
<td class="body-facilities"><sub><?php echo $row_rs['fac_wkdayS'];?> to <?php echo $row_rs['fac_wkdayE'];?> (Monday to Friday)</sub><br>
<sub><?php echo $row_rs['fac_wkendS'];?> to <?php echo $row_rs['fac_wkendE'];?> (Saturday & Sunday)</sub></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="submit" value="Next" class="button">
<input type="reset" name="reset" value="Reset" class="button">
</td>
</tr>
</table>
</form>
<?php
}
?>
</td>
</tr>
</table>
</body>
</html>