Location: PHPKode > scripts > PHP Data Validation > php-data-validation/example.php
<?php
$db_user = "";
$db_pass = "";
$db_serv = "";
$db_name = "";
include("../database/database.class.php");
$db = new Database($db_user,$db_pass,$db_serv,true);
if(!$db){die($db->getErrorMessage());}

include("validation.class.php");
$validation = new Validation;

echo "SELECT * FROM users WHERE user='".$validation->db_prep($validation->database_input)."'";
echo "<br>";

if($validation->email($validation->email)) echo "valid email";
else echo "not valid email";
echo "<br>";

if($validation->phone($validation->phone)) echo "valid phone";
else echo "not valid phone";
echo "<br>";

if($validation->url($validation->url)) echo "valid url";
else echo "not valid url";
echo "<br>";
?>
<form action="test.php" method="post">
	<p>database input: <input type="text" name="database_input" id="database_input" value="<?=$validation->database_input;?>" /></p>
    <p>email: <input type="text" name="email" id="email" value="<?=$validation->email;?>" /></p>
    <p>phone: <input type="text" name="phone" id="phone" value="<?=$validation->phone;?>" /></p>
    <p>url: <input type="text" name="url" id="url" value="<?=$validation->url;?>" /></p>
    <p><input type="submit" name="test" id="dtest" value="Test" /></p>
</form>
Return current item: PHP Data Validation