John Davidson

html - calling variable in bootstrap alert php

0 comments
Message:


I want to call $score into bootstrap alert but how do I call it correctly?.
I'm really a beginner


if ($score >= $threshold)
echo "<div class="alert alert-success solid alert-square"><strong></strong></div>";
echo $score."% Match";
else
echo $score. "% Didn't match";


My Answer:
To call the $score variable in a Bootstrap alert in PHP, you can concatenate the variable within the HTML code. Here is an example:

php
if ($score >= $threshold) {
echo '
' . $score . '% Match
';
} else {
echo $score . '% Didn\'t match';
}


In this code snippet, the $score variable is concatenated within the HTML code for the Bootstrap alert. The alert will display either the percentage followed by "Match" if the score is greater than or equal to the threshold, or the percentage followed by "Didn't match" if the score is less than the threshold.

Rate this post

3 of 5 based on 3889 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us