[Solved] Is there any way to Style Php variable with CSS?


I think im getting what you are asking for here;

// Set an array to hold all your errors
$messages = [];

// Define what inputs to validate
$fields_to_check = ['email', 'username', 'password'];

// Loop through and check for empty values
foreach($fields_to_check as $field)
{
    // Fill $messages with errors if validation failed.
    if (!isset($_POST[$field]) || empty($_POST[$field]))
    {
        $messages[$field] = ucfirst($field).' is required!';
    }
}

// If $messages is not empty, there are errors.
if (!empty($messages))
{
    $html="<ul>";
    foreach($messages as $input => $message)
    {
        $html .= '<li class="red">'.$message.'</li>';
    }
    $html .= '</ul>';

    return $html;
}

0

solved Is there any way to Style Php variable with CSS?