style of a PHP echo or print statemeent within an included html page -
part of validation script spits error codes depending on error. includes displaying html error page. statements print or echo out on error page force page downwards , seem impact odd things font size etc. default displays echo statements @ top of page in center. there way can style this? error message display @ areas within html?
if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){ echo 'you did not submit next required information! <br />'; if(!$first_name){ echo "first name required field. please come in below.<br />"; } if(!$last_name){ echo "last name required field. please come in below.<br />"; } if(!$email_address){ echo "email address required field. please come in below.<br />"; } include 'error_reg.htm'; exit(); }
actually quite straightforward, in echo, add/wrap html tag want on message. styling can want look. , placement of error exclusively you.
here super basic example:
<!-- or utilize external css file --> <style type="text/css"> .error-box { color:#555; font-family:tahoma,geneva,arial,sans-serif;font-size:11px; padding:10px 10px 10px 36px; margin:10px; background-color: #ffecec; border:1px solid #f5aca6; width: 300px; } </style> <?php $first_name = ''; if(!$first_name){ echo "<div class='error-box'>first name required field. please come in below.</div>"; } ?> php html include echo
No comments:
Post a Comment