Set value of hidden html label in php
Question by user1247412
I wish to change the value of html hidden label to a value of php variable. . And set its visibility to true. Can anyone tell me how to do this?
Answer by Jordan
<?php
$errorMessage = "Yes, there was an error";
?>
...
<?php
if ($errorMessage) {
print("<p>$errorMessage</p>");
}
?>
I hate PHP so much.
Answer by Starx
Labels cannot be hidden, unless CSS is used.
To hide an element by default, use hidden
element as
<input type="hidden" />
In case of using CSS is acceptable
CSS
.hidden { visibility: hidden; }
PHP
<?php $labelvalue = "somevalue"; ?>
<label for="someinput" name="somename" class="hidden"><?php echo $labelvalue; ?></label>