开发者

I can't find the wrong code on line 23 [closed]

开发者_JAVA百科 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

I can't find the wrong code on line 23.

<html>
<head><title>cw5</title></head>
<body> 
<form method=post>
Please enter 2 numbers: <br>
The first number: <input type="text" name="num1"><br>
The second number: <input type="text" name="num2"><br>
<input type="submit" value="Submit"></form><hr>
<?php 
   $num=$_POST["num1"]+$_POST["num2"];
   echo $_POST['num1']."+".$_POST['num2']."=".$num."<br>";

   $num2=$_POST["num1"]-$_POST["num2"];
   echo $_POST['num1']."-".$_POST['num2']."=" .$num2."<br>";

   $num3=$_POST["num1"]*$_POST["num2"];
   echo $_POST['num1']."x".$_POST['num2']."=" .$num3."<br>";

   $num4=$_POST["num1"]/$_POST["num2"];
   echo $_POST['num1']."/".$_POST['num2']."=" .$num4."<br>";

   $num5=$_POST["num1"]%$_POST["num2"];
   **echo "the remains of" $_POST['num1']."/".$_POST['num2']. "is".$num5."<br>";**
?>
<hr>
</body>
</html>


You're missing a . between "the remains of" and $_POST['num1']


Several minor syntax errors

  • Missing several "
  • Misplaced .

Here is the full code:

<html>
<head><title>cw5</title></head>
<body> 
<form method=post>
Please enter 2 numbers: <br>
The first number: <input type="text" name="num1"><br>
The second number: <input type="text" name="num2"><br>
<input type="submit" value="Submit"></form><hr>
<?php 
   $num=$_POST["num1"]+$_POST["num2"];
   echo $_POST['num1']."+".$_POST['num2']."=" .$num. "<br>";

   $num2=$_POST["num1"]-$_POST["num2"];
   echo $_POST['num1']."-".$_POST['num2']."=" .$num2. "<br>";

   $num3=$_POST["num1"]*$_POST["num2"];
   echo $_POST['num1']."x".$_POST['num2']."=" .$num3. "<br>";

   $num4=$_POST["num1"]/$_POST["num2"];
   echo $_POST['num1']."/".$_POST['num2']."=" .$num4. "<br>";

   $num5=$_POST["num1"]%$_POST["num2"];
   echo "the remains of " . $_POST['num1']."/".$_POST['num2']." is " .$num5;
?>
<hr>
</body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜