I have sevaral conditions that i am checking in a form to ensure that the user enters information into the form field before continuing. If a user does not enter in the information in lets say two of the three form fields I want both errors to be displayed. I am having trouble figure out how to concatenate the error message onto a string before returing it. Does any one know how to do this with object pointers bellow is my code the very last if statment returns the string with all the messages. I however dont think the += works for adding the messages on the $stringVar. Bellow is the code
$stringVar = "";
if (strlen($first_name) < 4)
{
$stringVar += $this->messages(36);
}
if (strlen($first_last) < 4)
{
$stringVar += $this->messages(37);
}
if (strlen($first_address) < 4)
{
$stringVar += $this->messages(38);
}
if (strlen($first_city) < 4)
{
$stringVar += $this->messages(39);
}
if(strlen($stringVar) != 0)
{
$this->the_msg =$stringVar;
return;
}