<?php $lname = $_POST['lname'];
if ( isset($_POST['lname'] )&& !empty( $_POST['lname'] ) ) {
echo '<div class="result"My blank is under</div> <div class="green"> $lname </div> ';
} else {
echo '<div class="result">Please tell them your</div> <div class="green">last name!</div> ';
}
?>
语法应该是正确的,但是当我在表单中输入数据时,echo 语句会在绿色类中显示变量名称 $lname 而不是输入的数据。
我是在某处忘记引号还是在某处逃跑?
<style>
.result {
color: #FFF;
display: block;
font-size: 36px;
margin-top: 1px;
margin-before: 5px;
margin-bottom: 0px;
margin-start: 0;
margin-end: 0;
text-align:center;
font-weight: bold; }
.green {
color: #C9FF1F;
display: block;
font-size: 40px;
margin-top: 1px;
margin-before: 5px;
margin-bottom: 0px;
margin-start: 0;
margin-end: 0;
text-align: center;
font-weight: bold;
}
</style>