Advertisement
Advertisement
| 04.22.2008 at 05:48AM PDT, ID: 23342673 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: |
<?php
// to remove the E_STRICT errors created by PEAR::Validate
error_reporting(E_ALL);
// Include Magic Quotes stripping script
require_once 'strip_quotes.php';
// Include PEAR::Validate
require_once 'Validate.php';
// Initialize errors array
$errors = array('name' => '', 'email' => '', 'url' => '');
// If the form is submitted...
if (isset($_POST['submit']))
{
// Define the options for formatting the name field
$name_options = array(
'format' => VALIDATE_ALPHA . VALIDATE_SPACE,
'min_length' => 5
);
// Validate name
if (!Validate::string($_POST['name'], $name_options))
{
$errors['name'] = ' class="error"';
}
// Validate email
if (!Validate::email($_POST['email']))
{
$errors['email'] = ' class="error"';
}
// Validate url
if (!Validate::url($_POST['url']))
{
$errors['url'] = ' class="error"';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PEAR::Validator</title>
<style type="text/css">
form.userinfo {
font-family: verdana;
font-size: 12px;
width: 30em;
}
form.userinfo h1 {
font-weight: bold;
font-size: 12px;
}
form.userinfo div {
clear: both;
margin: 5px 10px;
}
form.userinfo label {
float: left;
}
form.userinfo span {
float: right;
}
.error {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<form class="userinfo" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<?php
$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$url = isset($_POST['url']) ? $_POST['url'] : '';
?>
<h1>Enter your details</h1>
<div>
<label<?php echo $errors['name']; ?>>Name:</label>
<span>
<input type="text" name="name" value="<?php echo $name; ?>" />
</span>
</div>
<div>
<label<?php echo $errors['email']; ?>>Email:</label>
<span>
<input type="text" name="email" value="<?php echo $email; ?>" />
</span>
</div>
<div>
<label<?php echo $errors['url']; ?>>Website:</label>
<span>
<input type="text" name="url" value="<?php echo $url; ?>" />
</span>
</div>
<div>
<span>
<input type="submit" name="submit" value="send" />
</span>
</div>
</form>
</body>
</html>
|