刚刚学编程PHP就是计算过后输出不了结果点计算后像还原了 无 ?phperror_reporting(E_ALL ~E_NOTICE);if( isset($_POST['sub']) ){$sum="";switch($_POST['ysf']){ case ' ' : $sum=$_POST['num1'] $_POST['num2'];break;case '-' : $sum=$_POST['num1'] - $
刚刚学编程 PHP 就是计算过后输出不了结果 点计算后像还原了 11da01c6148ec3ec20c6fdc9adc31f96
<?php error_reporting(E_ALL & ~E_NOTICE); if( isset($_POST['sub']) ) { $sum=""; switch($_POST['ysf']) { case '+' : $sum=$_POST['num1'] + $_POST['num2'];break; case '-' : $sum=$_POST['num1'] - $_POST['num2'];break; case '*' : $sum=$_POST['num1'] * $_POST['num2'];break; case '/' : $sum=$_POST['num1'] / $_POST['num2'];break; case '%' : $sum=$_POST['num1'] % $_POST['num2'];break; } } echo '<br>'; ?> <HTML> <HEAD> <title>简单计算器</title> </HEAD> <body> <table horder="0" width="400" align="center"> <form action="JSQ.PHP" meyhod="post"> <caption><h1>简单计算器</h1></caption> <tr> <td> <input type="text" size="5" name="num1" value="" /><br> </td> <td> <select type="text" name="ysf"> <option value="+"> + </option> <option value="-"> - </option> <option value="x"> x </option> <option value="/"> / </option> <option value="%"> % </option> </select> </td> <td> <input type="text" size="5" name="num2" value="" /><br> </td> <td> <input type="submit" name="sub" value="计算"> </td> <tr> <tr> <td colspan="4"> <?php echo"计算结果 ={$sum} "; ?> </td> </tr> </form> </table> </body> </HTML>