PHP string concat doesn't trigger -


i've got following bit of code check if form multiple fields correctly filled. problem is, doesn't concat strings properly.

below code of code:

if(strlen($name) < 2 || strlen($email) < 6 || strlen($subject) < 5 || strlen($message) < 15){                 $alert = "there problems: \n";                  if(strlen($name) < 2){                     $alert . "name short \n";                 }                  if(strlen($email) < 6){                      $alert . "email short \n";                 }                  if(strlen($subject) < 5){                     $alert . "the subject short \n";                 }                  if(strlen($message) < 15){                      $alert . "your message short \n";                 }                  $alert . "please fill in te fields correctly";                  echo $alert;                 ?>                 <script>                 alert("<?= $alert ?>");                 </script>                 <?php             }             else { ... } ?> 

if place echo inside each if statement shows triggers, in end get's alerted , printed echo "there problems:"
why doesn't alert string gets concatinated? tried removing \n in each sentence didn't work either.

you should doing $alert .= "something", not $alert . "something".


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -