I can't find the wrong code on line 23 [closed]
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>
精彩评论