bsamson Posted November 13, 2015 Share Posted November 13, 2015 (edited) Hello. I am having a heck of a time figuring this one out. I have an array (output below) with info loaded. Everytime I run this, the output a blank page, no errors. Just curious, am I missing something? Thanks in advance for any help. print_r ($tmp_errors) output: Array ( [0] => cust_add1 ) <?php $styleForErrorBoxes = "style='border: 1px solid #FF0000'"; $tmp_errors = unserialize($result[0]['tmp_errors']); if ($tmp_errors) { if (array_key_exists('cust_email', $tmp_errors)) { $err_cust_email = $styleForErrorBoxes; } if (array_key_exists('cust_phone', $tmp_errors)) { $err_cust_phone = $styleForErrorBoxes; } if (array_key_exists('cust_first', $tmp_errors)) { $err_cust_first = $styleForErrorBoxes; } if (array_key_exists('cust_last', $tmp_errors)) { $err_cust_last = $styleForErrorBoxes; } if (array_key_exists('cust_add1', $tmp_errors)) { $err_cust_add1 = $styleForErrorBoxes; } if (array_key_exists('cust_add2', $tmp_errors)) { $err_cust_add2 = $styleForErrorBoxes; } if (array_key_exists('cust_city', $tmp_errors)) { $err_cust_city = $styleForErrorBoxes; } if (array_key_exists('cust_state', $tmp_errors)) { $err_cust_state = $styleForErrorBoxes; } if (array_key_exists('cust_zip', $tmp_errors)) { $err_cust_zip = $styleForErrorBoxes; } } echo $err_cust_add1; ?> Edited November 13, 2015 by bsamson Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 13, 2015 Share Posted November 13, 2015 (edited) Whatever your trying to accomplish, your doing it wrong. Something like $temp_errors = array(); if (empty(cust_add1)) { $temp_errors[] ='Address Required'; } Then if (count($tmp_errors)) { echo "<div class='error'>"; foreach($tmp_errors AS $error) { echo "$error<br>"; } echo '</div>'; } Edited November 13, 2015 by benanamen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.