Jump to content

Matching times


Xster

Recommended Posts

My time form suppose to accept the [b]numbers[/b] written as (eg: 01 for hours and 02 for minutes)
i've tried this regex code on my php code...
[b]$legit = ereg("^[0-9]{2,2}$", $time);[/b]

and here's my php code...
[code]<?php
if(!isset($_POST['submit']))
{
?>
<form action="" method="post">
<table width="100%" cellpadding="10" cellspacing="0" border="0">
<!--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">&nbsp;<input type="text" name="timeFrom" size="1" maxlength="2">&nbsp;:&nbsp;<input type="text" name="timeFrom1" size="1" maxlength="2">&nbsp;
<sup style="color:#FF0000">eg: 08:00</sup>
</td>
</tr>
<tr>
<td class="body-facilities">To:</td>
<td class="body-facilities">&nbsp;<input type="text" name="timeTo" size="1" maxlength="2">&nbsp;:&nbsp;<input type="text" name="timeTo1" size="1" maxlength="2">&nbsp;
<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'];?>&nbsp;to&nbsp;<?php echo $row_rs['fac_wkdayE'];?>&nbsp;(Monday to Friday)</sub><br>
<sub><?php echo $row_rs['fac_wkendS'];?>&nbsp;to&nbsp;<?php echo $row_rs['fac_wkendE'];?>&nbsp;(Saturday &amp; Sunday)</sub></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="submit" value="Next">   &nbsp;&nbsp;
<input type="hidden" name="fac_id" value="<?php echo $fac_id;?>"></td></tr>
</table>
</form>
<?php
}
?>
</td>
</tr>
</table>
</td>[/code]

mine does not work...
anybody got ideas for more tests I can run to pin down this problem..?
u guys rock...!
Link to comment
Share on other sites

Btw,
this link...
[url=http://www.badongo.com/pic/433848]http://www.badongo.com/pic/433848[/url]
suppose to show you the image of my php..
hope this will help...

p/s: effigy: i want my form accepting only [b]numbers[/b]...if you see mine still accepting any data entry such as letter,symbol or none (means nothing to put inside the box) please put the line if you got any ideas..thk u
Link to comment
Share on other sites

effigy,
Im not quiet sure..but still I need your attention..
what Im looking is,when I click button 'next'
then its shows prompt msg something like "Invalid Entry" (if user didnt insert numbers into the box)
pls forgive me if Im ask for stupid questions because Im freaking new bout this PHP.
Link to comment
Share on other sites

  • 2 weeks later...
No. How to setup?

I want the PHP to check for the errors (eg : no input or wrong time format) and put them all in an array, if there are some errors it should redirect back to the previous form (written in html and php) and display the errors, if there are no errors it should link to the confirmation page before the data save into database.

Is there any way to do that effigy? I already sent my php code before..hope you can show me how to setup..

Link to comment
Share on other sites

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.