I have a variable holding an array of errors
$errors = array();
I also have an if statement that returns whether or not a username has been entered in an input.
if(isset($_POST['submit'])) {
if(empty($_POST['username'])) {
echo array_push($errors, 'You did not submit a username' );
}
}
I'm using array_push() to add an error message at the end of it. I'm using a for each loop to retrieve the values of all the error fields. although I keep getting the number of array values as well as just the intended string.... For instance it will echo out "1 You did not submit a username"
foreach($errors as $e) {
echo $e;
echo "<br />\n";
}
is there anyway to retrieve just the required string?