我在www.codeacademy.com在线php编辑器中使用了以下代码。它不打印我想要的输出。请告诉我我犯错的地方
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="index.php" method="POST">
<input type= "text" name="num">
<input type="submit" name="submit">
</form>
<p>
<?php
if(isset($_POST['submit']))
{
$type=$_POST['num'];
echo "$type";
}
?>
</p>
</body>
</html>
答案 0 :(得分:0)
尝试使用echo $ type而不是echo&#34; $ type&#34 ;;
如果它不起作用,则替换action =&#34; index.php&#34;行动=&#34;&#34;
答案 1 :(得分:-1)
我在我的apache服务器上测试过,工作正常。只需将代码存储在index.php中,并使用http:// not file://
调用它