How to call validation errors using class object and display at the front of field?

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Without knowing what you have in the method I have no way of answering you. Frankly it sounds like you should be determining if there is an error before sending the output and if so, sen the error message instead of a call.

i am using <span>error</span> front of each field so when there would be an error so it will show to screen.. i just only want to know <?php echo $object->error['name']; ?> is this way right to call the variable? if so then i will have to do same for all fields..
<?php echo $object->error['name']; ?>
<?php echo $object->error['pass']; ?>
<?php echo $object->error['email']; ?>
<?php echo $object->error['lastname']; ?>
<?php echo $object->error['age']; ?>
<?php echo $object->error['dob']; ?>
right?

My personal phobia is to use php tags in my code. One is enough for a script usually. In your case, you apparently are doing some kind of call to check your inputs for errors, then when you create your output html you make another call (in php/out of php) to get the error message. Me - I would capture the error messages and then output them instead of making another call to generate the message. That can then be done by simply including the php var in the html code using a heredocs (look it up).

i just want to know is this good way <?php echo $object->error['name']; ?>
<?php echo $object->error['pass']; ?>
<?php echo $object->error['email']; ?>
<?php echo $object->error['lastname']; ?>
<?php echo $object->error['age']; ?>
<?php echo $object->error['dob']; ?>
to call a public variables again and again or any good practice ....