Hi. I'm a newbie: both to this news group and to land of Perl/cgi :o) .... I'd appreciate getting some help with a form validation script!
I'm working on a conference room reservation form. The html form has fields for name, title of meeting, day/month/year, start time and end time. My current problem is the date validation - I need it to not only check for whether there has not been a selection made, but also whether the start time is => end time and end time <= start time, returning errors in any of these cases. My form fields for time start and time end are selection boxes, both with the am/pm designation included with the numeric time - i.e.6:00 am through 6:00pm (in half hour increments). The problem is when the start time is =< 12:30 pm and the end time selected is =>1pm -- if this selection is made, the .cgi sees the end time as less than the start time and returns an error. If I change the selection box listing to military time, I can get the script to work, but I don't like using that format (and I think most users would agree). What code can I use to make the .cgi recognize the difference in am/pm using the standard time format? Thanks, Marjie -------- Here's is the portion of my .cgi showing the code for the time field(s) validation: elsif ($in{'timestart'} eq "Select one:") { print "<html><body bgcolor=red><table width=50% bgcolor=white>\n"; print "<tr><td><b>Oops! You forget to fill in the `Time Start' field.\n"; print "<p><b>Use the back button to return to the form\n"; print "<b>and complete the info needed. Thank you!</b></td></tr></table></body></html>"; } elsif ($in{'timeend'} eq "Select one:") { print "<html><body bgcolor=red><table width=50% bgcolor=white>\n"; print "<tr><td><b>Oops! You forget to fill in the `Time End' field.\n"; print "<p><b>Use the back button to return to the form\n"; # print "<b>and complete the info needed. Thank you!</b></td></tr></table></body></html>"; } if ($in{'timestart'} >= $in{'timeend'} ) { print "<html><body bgcolor=red><table width=50% bgcolor=white>\n"; print "<tr><td><center><b>Oops!</center>\n"; print "<b>Your `<font color=red>Time Start and Time End' *are in conflict*</font><br> \n"; print "<b>Please use the back button to return to the\n"; print "<b>reservation form, and reselect your \n"; print "<b>start or end time.<br>\n"; print "<center><b>Thank you!</b></center></td></tr></table></body></html>"; } else { -------------- FYI-After this portion of the code, the .cgi is to open the .txt database and check for any duplicate entry. If none found, it writes; if duplicate date found, it should return another error. But haven't gotten that far yet! Thanks in advance for help correcting/completing this code! Marjie --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.486 / Virus Database: 284 - Release Date: 5/29/2003