#native_company# #native_desc#
#native_cta#

Valiates

By kartik
on May 17, 2005

Version: 1.0

Type: Function

Category: Algorithms

License: GNU General Public License

Description: Show how to validate various things. name, email, phone number, time, numerical data.



<?php
function validate ($first, $second, $timein, $timeout, $start, $end)

{
							if (!eregi('^[a-zA-Z]+$', $first))
								{$error = "please re-enter, first name not valid! <br />";
								 }
							elseif (!eregi('^[a-zA-Z]+$', $second))
								{$error =  "please re-enter, second name not valid!<br />";}
								elseif (!eregi('^[0-9]+:[0-9]+ [AMPM]+$', $timein))
								{$error =  "please re-enter, time in not valid! Make Sure time has capital AM or PM and time and AM or PM is seperated by a space..<br />";}
							elseif (!eregi('^[0-9]+:[0-9]+ [AMPM]+$', $timeout))
								{$error =  "please re-enter, time out not valid! Make Sure time has capital AM or PM and time and AM or PM is seperated by a space..<br />";}
								elseif (!eregi('^[0-9]+$', $start))
								{$error = "please re-enter, starting odometer reading not valid!<br />";}
							elseif (!eregi('^[0-9]+$', $end))
								{$error =  "please re-enter, ending odometer reading not valid!<br />";}
								elseif ( !($end > $start)){echo "<br />please re-enter, ending odometer reading is less than starting odometer reading!";}
							elseif ( $name =="name"
							|| $first == "Client First Name" || $second == "Client Second Name")
							{ $error ==  "<br />Field values not changed";}
							else ($error = "0");
							
							return $error;
							
							}
							?>