0

This is my code that is returning a error: Notice: Array to string conversion in /Applications/XAMPP/xamppfiles/htdocs/cim/msgboard/login.php on line 29 (echo " - $msg
" ;)

  • Array

      <?php
              include('includes/header_login.inc') ;
              if (isset($errors) && !empty($errors)) {
              echo '<p id="err_msg">A problem has occurred:<br>' ;
              foreach($errors as $msg) {
              echo " - $msg<br>" ;
              }
             echo 'please try again or <a href="registration-page.php">Register</a></p>' ;  
      }
      ?>       
    
CLamb
  • 1

1 Answers1

1

First of all you have to print message like $msg['message'] and if you want to add some HTML in your PHP it should be like:

echo "- ".$msg['message']."<br>";

When you $msg in " here ", print will like:

-$msg.

PHP can not understand the variable in the echo so you should close the quotes.

Mike
  • 4,041
  • 6
  • 20
  • 37
kkrgzz
  • 452
  • 4
  • 12