感觉我已经尝试了所有可能的方式......现在它只是跳过if语句并发布了html。
<? if ($departmentID == 1 : ?>
<h4>Outreach Questions <?= $departmentID ?><h4>
<h4>Why Interested</h4>
<ul>
<strong>Why are you interested in volunteering as an outreach docent? </strong> <?php echo $whyInterested ?>
</ul>
<h4>Wildlife Issues</h4>
<ul>
<strong>What’s an environmental or wildlife issue you feel passionately about, and why? </strong> <?php echo $wildlifeIssue ?>
</ul>
<h4>Public Speaking</h4>
<ul>
<strong>Do you have prior experience speaking to the public? Please describe. </strong> <?php echo $publicSpeaking ?>
</ul>
<h4>Wildlife Groups</h4>
<ul>
<strong>Do you belong to any animal rights groups (PETA, The Humane Society, etc.)? If so, which ones? </strong> <?php echo $wildlifeGroup ?>
</ul>
<h4>Contributions</h4>
<ul>
<strong>What do you think you’d bring to the outreach volunteer team?</strong> <?php echo $bringToTeam ?>
</ul>
<? endif; ?>
</div>
如果id == 2等等,那么我的想法是做一个else。但是无论departmentID如何,它都会推出所有的HTML。
提前感谢。
答案 0 :(得分:0)
漂亮的第一线不是错的吗?你没有关闭它:
更改第一行:
<?php if ($departmentID == 1) : ?>
答案 1 :(得分:0)
<?php if ($departmentID == 1) {
echo " <h4>Outreach Questions = '$departmentID' </h4> #all html below
</ul>";} # ends block and closes echo
?>
</div>
尝试这个它使用php来回显所有的html如果情况为真,否则没有html得到回应