I have a class that validates the posted data in the form..
Code: Select all
if ($this->iAgree != 'checked')
{
$this->errors[] = 'You must agree to the terms of service.';
}I thought about assigning each error an id.. like this..
Code: Select all
if ($this->iAgree != 'checked')
{
$this->errors[2] = 'You must agree to the terms of service.';
}But if I do that, I'll lose some of the errors because a question might have more than 1 error at a time. ie too long and contains invalid characters.
So... do I have to create a 2nd variable to indicate which question to highlight?
I'm just wondering how others would do something like this.
The form would look something like this..
Code: Select all
<td <?php if (isset($this->errors[2])) echo 'class="redBackground"'; ?>><input type="text" name="something" value="<?php echo $this->something; ?>" /></td>