snarf1974
02-15-2009, 09:55 PM
Hi guys,
I'm building a form, but having a problem with some span tags.
If the form fields remain empty after the user has clicked submit, this error kicks in via PHP, using CSS to style the span tag:
http://www.glentechsolutions.co.uk/images/form-error.jpg
All well and good here, BUT, if the user navigates to this page (Contact Us), the span tag shows a border:
http://www.glentechsolutions.co.uk/images/form.jpg
This is the span tag:
<input type="text" name="name" id="name" value="<?= htmlentities($values['name']) ?>" size="22" tabindex="1" class="required" /><span class="error"><?= $errors['name'] ?></span></p>
And this is the CSS:
span.error {
float: left;
width: 305px;
background: #FF0000;
color: #fff;
border: 1px solid #999;
margin:4px 0 4px 0;
padding-left: 5px;
display: inline;
}
Is there a way to hide the border from the span tag, and only show it when the PHP validation kicks in? or, is there just a different/better way to achieve this?
Many thanks
I'm building a form, but having a problem with some span tags.
If the form fields remain empty after the user has clicked submit, this error kicks in via PHP, using CSS to style the span tag:
http://www.glentechsolutions.co.uk/images/form-error.jpg
All well and good here, BUT, if the user navigates to this page (Contact Us), the span tag shows a border:
http://www.glentechsolutions.co.uk/images/form.jpg
This is the span tag:
<input type="text" name="name" id="name" value="<?= htmlentities($values['name']) ?>" size="22" tabindex="1" class="required" /><span class="error"><?= $errors['name'] ?></span></p>
And this is the CSS:
span.error {
float: left;
width: 305px;
background: #FF0000;
color: #fff;
border: 1px solid #999;
margin:4px 0 4px 0;
padding-left: 5px;
display: inline;
}
Is there a way to hide the border from the span tag, and only show it when the PHP validation kicks in? or, is there just a different/better way to achieve this?
Many thanks