Php if,else不工作

Php if,else不工作,php,html,Php,Html,这是我在html文件中使用的代码 <? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"]): ?> You must provide your name, gender, and dorm! Go <a href="froshims2.php">back</a>. <? else: ?> You are registered! (We

这是我在html文件中使用的代码

<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"]): ?>
  You must provide your name, gender, and dorm!  Go <a href="froshims2.php">back</a>.
<? else: ?>
  You are registered!  (Well, not really.)
<? endif ?>

此行缺少右括号

<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"]): ?>
在if语句末尾缺少一个
,在
endif
后面缺少一个分号:

<? if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"])): ?>
  You must provide your name, gender, and dorm!  Go <a href="froshims2.php">back</a>.
<? else: ?>
  You are registered!  (Well, not really.)
<? endif; ?>

您必须提供您的姓名、性别和宿舍!去吧。
你已经注册了!(嗯,不是真的。)
如果(空($\u POST[“name”])| |空($\u POST[“gender”])| | |空($\u POST[“dorm”]):?>
缺失)在结尾之前:


<?php
if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"])) 
  echo 'You must provide your name, gender, and dorm!  Go <a href="froshims2.php">back</a>.';
else
  echo "You are registered!  (Well, not really.)";
?>

同样
应该是
在php关闭标记之前不需要分号谢谢,是的,错误在if上缺少的括号中line@MackieeE@MattGibson Noted=)我有时也会忘记意识到这一点!为那个错误道歉。没问题,很乐意帮忙
<?php
if (empty($_POST["name"]) || empty($_POST["gender"]) || empty($_POST["dorm"])) 
  echo 'You must provide your name, gender, and dorm!  Go <a href="froshims2.php">back</a>.';
else
  echo "You are registered!  (Well, not really.)";
?>