计算一个圆
我这样做了,但当我尝试在 Internet Explorer 上查看 PHP 部分时,我看不到它。
这是我所做的代码:
<html>
<head><title>Practise</title></head>
<body>
<form method="post">
Circumference of a Circle or the Area: <br>
The Radius of the circle: <input type="text" name="radius"><br>
<input type="submit" value="Submit">
<?php
$rad = (float) $_POST['radius'];
$cir = $rad * 2 * pi();
$area = pow($rad, 2) * pi();
echo "The circumference of the circle is:" $cir.;
echo "The area of the circle is:" $area.;
?>
</body>
</html>
请指出错误的代码。谢谢你!
I did this but I can't see the PHP part when I tried to view it on Internet Explorer.
This is the code I did:
<html>
<head><title>Practise</title></head>
<body>
<form method="post">
Circumference of a Circle or the Area: <br>
The Radius of the circle: <input type="text" name="radius"><br>
<input type="submit" value="Submit">
<?php
$rad = (float) $_POST['radius'];
$cir = $rad * 2 * pi();
$area = pow($rad, 2) * pi();
echo "The circumference of the circle is:" $cir.;
echo "The area of the circle is:" $area.;
?>
</body>
</html>
Please state the wrong code. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
两条回显线应该是:
连接运算符(点)位于要合并的字符串之间。
由于语法错误,您当前的代码未执行。
The two echo lines should be:
The concatenation operator (point) goes between the strings you want to merge.
Your current code isn't executed because of a syntax error.
好吧,首先你的字符串连接错误:
然后你真的应该做一些输入检查:
还有一个结束
标签丢失,以及
action="..."
最后是“练习”,而不是“练习”......:)
Well first you got string concatenation wrong:
Then you should really do some input checking:
There's also a closing
</form>
tag missing, as well as theaction="..."
attribute on the<form>
tag -- although this should default to the page itself.And finally it's 'Practice', not 'Practise'... :)
你的回声被打破了:
Your echos are broken:
这是更好的:
This is better: