Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form validation

Status
Not open for further replies.

Sunil606

Programmer
Dec 8, 2003
27
GB
I need to validate each text field which prompts users to make sure they enter in their details. I have a few queries like:-

a)Validate credit card details, the start and the end date.
b)Validate email addresses
c)Validate the first and the last name






<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<table width=&quot;900&quot; border=&quot;0&quot;>
<tr>
<td width=&quot;155&quot; bgcolor=&quot;#FF9900&quot;>&nbsp;</td>
<td width=&quot;155&quot; bgcolor=&quot;#FF9900&quot;><div
align=&quot;center&quot;><font color=&quot;#0000FF&quot;><font color=&quot;#FFFFFF&quot; size=&quot;+1&quot;><strong> <td width=&quot;&quot; bgcolor=&quot;#FF9900&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;164&quot; height=&quot;542&quot; valign=&quot;top&quot;><table width=&quot;155&quot; border=&quot;0&quot;>
</table>
<table width=&quot;155&quot; border=&quot;0&quot; frame=&quot;void&quot; >
<tr>
<td height=&quot;22&quot; bgcolor=&quot;#FFFFFF&quot;><img src=&quot;images/movie_reel.gif&quot; width=&quot;157&quot; height=&quot;141&quot;>
</td>
</tr>
<tr>
<td height=&quot;24&quot; bgcolor=&quot;#FFFFFF&quot;>&nbsp;</td>
</tr>
<tr>
<td height=&quot;24&quot; bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#666666&quot;>&nbsp;</font>
<a href=&quot;screen1.htm&quot;><strong><font color=&quot;#ff9900&quot; size=&quot;+1&quot;>HomePage
</font></strong></a> </div></td>
</tr>
<tr>
<td bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>&nbsp;</strong></font><strong><font color=&quot;#66CCFF&quot; size=&quot;+1&quot;><a href=&quot;screen2.htm&quot;>Book
Tickets</a></font></strong></div></td>
</tr>
<tr>
<td bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>Film
Reviews</strong></font></div></td>
</tr>
<tr>
<td bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>Film
Search</strong></font></div></td>
</tr>
<tr>
<td bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong><a href=&quot;screen10.htm&quot;>Cinema/Location</a></strong></font></div></td>
</tr>
<tr>
<td height=&quot;22&quot; bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>Coming
Soon</strong></font></div></td>
</tr>
<tr>
<td bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>Careers</strong></font></div></td>
</tr>
<tr>
<td bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>About
Cinema</strong></font></div></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>FAQs</strong></font></div></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>Sign
In </strong></font></div></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><font color=&quot;#ff9900&quot;><strong>New
Register </strong></font></div></td>
</tr>
</table>
<td bgcolor=&quot;#3366FF&quot; valign=&quot;top&quot;><table width=&quot;590&quot; border=&quot;0&quot;>
<tr>
<td> <div align=&quot;center&quot;></div></td>
</tr>
</table>
<table width=&quot;590&quot; border=&quot;0&quot;>
<tr>
<td><div align=&quot;center&quot;><font size=&quot;+7&quot;><tt><font size=&quot;+7&quot;><tt><font color=&quot;#FF9900&quot; size=&quot;7&quot; face=&quot;Arial&quot;><dfn><strong><var><em><ins>Vue
Vision Cinema</ins></em></var></strong></dfn></font></tt></font></tt></font></div></td>
</tr>
<tr>
<td height=&quot;24&quot;>&nbsp;</td>
</tr>
<tr>
<td><div align=&quot;center&quot;><font color=&quot;#99FFFF&quot; size=&quot;+3&quot; face=&quot;Monotype Corsiva&quot;><strong>Payment
Details </strong></font></div></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><div align=&quot;right&quot;><strong><font color=&quot;#FFFF00&quot; size=&quot;3&quot;>Help
| <a href=&quot;screen4.htm&quot;>Amend
Booking</a> | <a href=&quot;screen7.htm&quot;>Back</a> | <a href=&quot;screen9.htm&quot;>Next</a></font></strong></div></td>
</tr>
<tr>
<td height=&quot;269&quot; bgcolor=&quot;#3366ff&quot;> <table width=&quot;599&quot; height=&quot;160&quot; border=&quot;0&quot; bordercolor=&quot;#3366FF&quot;>
<tr bgcolor=&quot;#FF9900&quot;>
<td height=&quot;22&quot; colspan=&quot;4&quot;> <div align=&quot;left&quot;><font color=&quot;#FFFFFF&quot; size=&quot;+2&quot;><strong><font size=&quot;+1&quot;>Step
6- </font></strong></font><font color=&quot;#FFFFFF&quot; size=&quot;+1&quot;><strong>Please
complete the following details</strong></font></div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td bgcolor=&quot;#3366FF&quot;>&nbsp;</td>
<td bgcolor=&quot;#3366FF&quot;>&nbsp;</td>
<td bgcolor=&quot;#3366FF&quot;>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td width=&quot;149&quot; bgcolor=&quot;#3366FF&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>First
Name: </strong></font></div></td>
<td width=&quot;152&quot; bgcolor=&quot;#3366FF&quot;><font color=&quot;#3300CC&quot;>
<input type=&quot;text&quot; name=&quot;Firstname&quot;>
</font></td>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>Card
Type:</strong></font></div></td>
<td><div align=&quot;left&quot;><font color=&quot;#3300CC&quot;>
<select name=&quot;CardType&quot;>
<option value=&quot;Visa&quot;>Visa
<option value=&quot;Switch&quot;>Switch
<option value=&quot;Mastercard&quot;>Mastercard
</select>
<select name=&quot;select&quot;>
<option value=&quot;Debit Card&quot;>D/D
<option value=&quot;Credit Card&quot;>C/C
<option value=&quot;Switch&quot;>Switch
</select>
</font></div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td width=&quot;149&quot; valign=&quot;top&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong><font color=&quot;#FFFF00&quot;>Last
Name:</font></strong></font></div></td>
<td width=&quot;152&quot;> <div align=&quot;left&quot;><font color=&quot;#3300CC&quot;>
<input type=&quot;text&quot; name=&quot;Lastname&quot;>
</font></div></td>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>Card
Number:</strong></font></div></td>
<td> <div align=&quot;left&quot;><font color=&quot;#3300CC&quot;>
<input type=&quot;text&quot; name=&quot;CardNumber&quot;>
</font></div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td colspan=&quot;&quot; valign=&quot;top&quot;><div align=&quot;right&quot;><strong><font color=&quot;#FFFF00&quot;>Email
Address:</font></strong></div></td>
<td> <div align=&quot;left&quot;><font color=&quot;#3300CC&quot;>
<input type=&quot;text&quot; name=&quot;Emailaddress&quot;>
</font></div></td>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>Expiry
Date:</strong></font></div></td>
<td> <div align=&quot;left&quot;><font color=&quot;#3300CC&quot;>
<select name=&quot;expirydatemonth&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
<font color=&quot;#FFFFFF&quot;>(mon)</font></font> <font color=&quot;#3300CC&quot;>
<select name=&quot;adulttickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
<font color=&quot;#FFFFFF&quot;>(yr)</font></font></div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td width=&quot;149&quot; height=&quot;26&quot; valign=&quot;top&quot;><div align=&quot;right&quot;><strong><font color=&quot;#FFFF00&quot;>No.
of Adult tickets:</font></strong></div></td>
<td width=&quot;152&quot;> <div align=&quot;left&quot;><strong><font color=&quot;#FFFFFF&quot;>
<select name=&quot;adulttickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
@ &pound;6.30 each</font></strong></div></td>
<td valign=&quot;top&quot; height=&quot;31&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>Start
Date:</strong></font></div></td>
<td><div align=&quot;left&quot;><font color=&quot;#3300CC&quot;>
<select name=&quot;adulttickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
<font color=&quot;#FFFFFF&quot;>(mon)</font></font> <font color=&quot;#3300CC&quot;>
<select name=&quot;adulttickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
<font color=&quot;#FFFFFF&quot;>(yr)</font></font></div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><strong><font color=&quot;#FFFF00&quot;>No.
of student tickets:</font></strong></div></td>
<td valign=&quot;top&quot;> <div align=&quot;left&quot;><strong><font color=&quot;#FFFFFF&quot;>
<select name=&quot;studenttickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
@ &pound;4.70 each</font></strong></div></td>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>Issue
No: </strong></font></div></td>
<td> <div align=&quot;left&quot;>
<select name=&quot;IssueNo&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
</select>
</div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot;><strong>Nus No:</strong></font></div></td>
<td><input type=&quot;text&quot; name=&quot;Lastname2&quot;></td>
<td width=&quot;106&quot;>&nbsp;</td>
<td width=&quot;174&quot;>&nbsp;</td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><strong><font color=&quot;#FFFF00&quot;>No.
of children tickets:</font></strong></div></td>
<td> <div align=&quot;left&quot;><strong><font color=&quot;#FFFFFF&quot;>
<select name=&quot;childrentickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
@ &pound;4.70 each</font></strong></div></td>
<td><div align=&quot;right&quot;><font color=&quot;#FFFF00&quot; size=&quot;4&quot;><strong>Total
to Pay:</strong></font></div></td>
<td> <div align=&quot;left&quot;><strong><font color=&quot;#FFFFFF&quot; size=&quot;5&quot;>
&nbsp;&pound;11.00</font></strong></div></td>
</tr>
<tr bgcolor=&quot;#3366FF&quot;>
<td valign=&quot;top&quot;><div align=&quot;right&quot;><strong><font color=&quot;#FFFF00&quot;>No.
of O.A.P tickets:</font></strong></div></td>
<td> <div align=&quot;left&quot;><strong><font color=&quot;#FFFFFF&quot;>
<select name=&quot;OAPtickets&quot;>
<option value=&quot;0&quot;>0
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>2
<option value=&quot;3&quot;>3
<option value=&quot;4&quot;>4
<option value=&quot;5&quot;>6
<option value=&quot;6&quot;>6
<option value=&quot;7&quot;>7
<option value=&quot;8&quot;>8
<option value=&quot;9&quot;>9
<option value=&quot;10&quot;>10
</select>
@ &pound;4.70 each</font></strong></div></td>
<td>&nbsp;</td>
<td><strong><font color=&quot;#000000&quot; size=&quot;1&quot;>(Handling fee of 50p
on each ticket)</font></strong></td>
</tr>
</table></td>
</tr>
<tr>
<td><div align=&quot;center&quot;><img src=&quot;images/Disabilitypicts.GIF&quot; width=&quot;46&quot; height=&quot;27&quot;><font color=&quot;#FFFFFF&quot; size=&quot;2&quot; face=&quot;Times New Roman, Times, serif&quot;>
We do cater for all disability, If you need any further assistant
please so not hesitate to call us on 0870 123 4567</font> <font color=&quot;#FFFF33&quot; size=&quot;+4&quot; face=&quot;Monotype Corsiva&quot;>
</font></div></td>
</tr>
</table>
<td width=&quot;195&quot; bgcolor=&quot;#FFFFFF&quot; valign=&quot;top&quot;><table width=&quot;155&quot; border=&quot;0&quot;>
<tr>
<td><img src=&quot;Images/Cheaperbythedozen.gif&quot; width=&quot;157&quot; height=&quot;255&quot;></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src=&quot;images/lordoftherings2.gif&quot; width=&quot;157&quot; height=&quot;255&quot;></td>
</tr>
</table></td>
</tr>
<tr >
<tr>
<td width=&quot;155&quot; height=&quot;22&quot; bgcolor=&quot;#FF9900&quot;>&nbsp;</td>
<td width=&quot;155&quot; bgcolor=&quot;#FF9900&quot;><div align=&quot;center&quot;><font color=&quot;#0000FF&quot;>&nbsp;<font color=&quot;#0000FF&quot;><font color=&quot;#FFFFFF&quot; size=&quot;+1&quot;><strong> <td width=&quot;&quot; bgcolor=&quot;#FF9900&quot;>&nbsp;</td>

</table>
</body>
</html>
 
Regular expressions are a great way to do string validation. Here are a couple tutorials on how to use them, if you'd like to do it yourself. However, if you'd like a pre-made expression for the fields you could probably do a google search to find them. Search for something like this: &quot;email validation regular expression&quot;




-kaht

banghead.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top