Log in

View Full Version : How to colour fields if there is error? Simple question



toplisek
05-09-2007, 11:03 AM
Hello,
I have problem how to do correct code with PHP:
1.colour text and input box if there is an error in form.

Need help.

I have the following code but it is wrong:


<?PHP (isset($error)) ? 'class=headingERROR' : 'class=headingCORRECT' ;?>
<input name="firstname" class="box" maxlength="30" size="20">


Regards:)

boogyman
05-09-2007, 04:11 PM
if you want to do them 1 line at a time, then I suggest you use javascript and the onchange method to validate what has been entered. However if you choose to go with php, then the fix isn't as simple. If no one has answered you by 5pm EST I will give you a solution that I came up with, as I am presently at work.