1.å¦ä½ç¨PHPåç计ç®å¨å
å¦ä½ç¨PHPåç计ç®å¨å
<?计p简源码注解php/
*** Created by PhpStorm.
* User: ITAK
* Date: /3/3
* Time: :
*/
error_reporting(E_ALL & ~E_NOTICE); if(isset($_POST['submit'])){ $ok = true; $error = "åºç°çé®é¢ï¼<br>"; if($_POST['num1'] == ""){ $ok = false; $error = $error."第ä¸ä¸ªæ°åä¸è½ä¸ºç©º<br>";
} else{ if(!is_numeric($_POST['num1'])){ $ok = false; $error = $error."第ä¸ä¸ªæ°åä¸æ¯æ°å<br>";
}
} if($_POST['num2'] == ""){ $ok = false; $error = $error."第äºä¸ªæ°åä¸è½ä¸ºç©º<br>";
} else{ if(!is_numeric($_POST['num2'])){ $ok = false; $error = $error."第äºä¸ªæ°åä¸æ¯æ°å<br>";
}
}
} if($ok){ $sum = ""; $fuhao = $_POST['fuhao']; if($fuhao == '+') $sum = $_POST['num1'] + $_POST['num2']; if($fuhao == '-') $sum = $_POST['num1'] - $_POST['num2']; if($fuhao == '*') $sum = $_POST['num1'] * $_POST['num2']; if($fuhao == '/') $sum = $_POST['num1'] / $_POST['num2']; if($fuhao == '%') $sum = $_POST['num1'] % $_POST['num2'];
} echo "<br>";?><html>
<head>
<meta charset="UTF-8">
<title>ç®å计ç®å¨</title>
</head>
<body>
<table border="0" width="" align="center">
<form action="cal.php" method="post">
<caption><h1>ç®å计ç®å¨</h1></caption>
<tr>
<td>
<input type="text" size="5" name="num1" value="<?php echo $_POST['num1'] ?>"/>
</td>
<td>
<select name="fuhao">//ä¸æå表 <option <?php if($_POST['fuhao']=="+") echo "selected"?>
value="+"> + </option>
<option <?php if($_POST['fuhao']=="-") echo "selected"?>
value="-"> - </option>
<option <?php if($_POST['fuhao']=="*") echo "selected"?>
value="*"> * </option>
<option <?php if($_POST['fuhao']=="/") echo "selected"?>
value="/"> / </option>
<option <?php if($_POST['fuhao']=="%") echo "selected"?>
value="%"> % </option>
</select>
</td>
<td>
<input type="text" name="num2" size="5" value="<?php echo $_POST['num2'] ?>"/>
</td>
<td>
= </td>
<td>
<input type="text" name="res" size="5" value="<?php echo $sum ?>"/>
</td>
</tr>
<tr align="center">
<td>
<input type="submit" value="计ç®" name="submit">
</td>
</tr>
<br>
<tr>
<td colspan="4">
<?php
if($ok){ echo "ç»æ为: { $_POST['num1']} { $_POST['fuhao']} { $_POST['num2']} = { $sum}";} else{ echo $error;} ?>
</td>
</tr>
</form>
</table>
</body></html>
俄國家杜馬審議通過法案:俄國民衛隊可建立志願兵編隊
指标源码详解_指标源码大全
armlinux源码编译
系统源码计算
巴基斯坦反恐部門稱打死一名恐怖分子頭目
bundle底层源码_bundlefusion 源代码阅读